PageSourceSearch

https://app.socialgest.ai/chunk-JUCCT54W.js

js socialgest.ai collected 2026-10-05 15:08:23 UTC 671,543 bytes, 14,476 lines download raw bytes

1import {
2  AiTextGeneratorComponent,
3  AnalyticsService,
4  AnchormePipe,
5  AvatarComponent,
6  BaseComponent,
7  BaseSubscriber,
8  ButtonComponent,
9  ChipComponent,
10  ConfirmDialogService,
11  ConnectFacade,
12  Cyclic,
13  CyclicListComponent,
14  CyclicListSearchComponent,
15  CyclicListStore,
16  CyclicListSubscriber,
17  DatepickerComponent,
18  DefaultValueAccessor,
19  DialogService2 as DialogService,
20  EmojiPickerComponent,
21  EmptyListComponent,
22  EmptyStateComponent,
23  FormControl,
24  FormControlDirective,
25  FormGroup,
26  FormatDurationPipe,
27  FormatMsPipe,
28  FormsModule,
29  GroupDetailsComponent,
30  GroupListComponent,
31  GroupListSearchComponent,
32  GroupService,
33  GroupStore,
34  GroupSubscriber,
35  IgAudio,
36  InfiniteScrollDirective,
37  InputSearchComponent,
38  InputTextComponent,
39  LinkShortenedEvent,
40  LocaleDatePipe,
41  LocationService,
42  MenuComponent,
43  MessengerActionType,
44  MessengerStore,
45  MultimediaListComponent,
46  Music,
47  NgControlStatus,
48  NgModel,
49  PopoverComponent,
50  Post,
51  PostCompletedEvent,
52  PostDraftedEvent,
53  PostIdeaDeletedEvent,
54  PostIdeaSavedEvent,
55  PostInstantPublishFailedEvent,
56  PostInstantPublishSucceededEvent,
57  PostInstantPublishingEvent,
58  PostPublishedNowEvent,
59  PostReuseEvent,
60  PostScheduledEvent,
61  PostSentToApprovalEvent,
62  PostSentToPushEvent,
63  PostUpdateEvent,
64  PostUpdatedEvent,
65  PreviewComponent,
66  PublicationMethod,
67  PublicationType,
68  ReactiveFormsModule,
69  SaveGroupComponent,
70  ScrollSyncDirective,
71  SegmentComponent,
72  SegmentListComponent,
73  SelectCampaignComponent,
74  SelectComponent,
75  SelectItemDirective,
76  SelectSelectedItemDirective,
77  SelectTimezoneComponent,
78  ShortenerConfigStore,
79  ShortenerType,
80  SkeletonDirective,
81  SkeletonListComponent,
82  SonnerToasterService,
83  TabsComponent,
84  TextareaComponent,
85  TextareaService,
86  ThreadPostList,
87  ToggleComponent,
88  TooltipDirective,
89  TranslatePipe,
90  TranslocoService,
91  UploaderLoadingEvent,
92  UrlQuotaService,
93  UseCase,
94  UseCaseProgress,
95  User,
96  UserAvatarListComponent,
97  UserIconPipe,
98  UserList,
99  UserListComponent,
100  UserSearchComponent,
101  UserStore,
102  UserType,
103  Validators,
104  WrappedSocket,
105  YoutubeTitleLengthValidation,
106  countries,
107  creditGateErrorKey,
108  dialogConfig,
109  extractShortenableUrls,
110  getInstantPublicationNetworkLabel,
111  hasXLink,
112  linkStore,
113  progressBuilder,
114  takeUntilDestroyed,
115  toSignal,
116  toast,
117  uploaderService
118} from "./chunk-OYZR5XO4.js";
119import {
120  HttpClient
121} from "./chunk-YQMA3R7Y.js";
122import {
123  IconComponent,
124  LucideAngularComponent,
125  LucideAngularModule
126} from "./chunk-ZHZLP2SD.js";
127import {
128  $date,
129  $string,
130  E,
131  Entity,
132  EntityList,
133  Exception,
134  Multimedia,
135  MultimediaList,
136  RequestFailedEvent,
137  URL_REGEX,
138  bus,
139  convert,
140  environment,
141  esm_exports,
142  is,
143  random,
144  sleep,
145  when
146} from "./chunk-GETVOWP3.js";
147import {
148  CommonModule,
149  NgClass
150} from "./chunk-H772AUOS.js";
151import {
152  Component,
153  DestroyRef,
154  ElementRef,
155  Injectable,
156  Injector,
157  ViewEncapsulation,
158  catchError,
159  computed,
160  defer,
161  delay,
162  effect,
163  firstValueFrom,
164  forkJoin,
165  inject,
166  input,
167  lastValueFrom,
168  linkedSignal,
169  map,
170  mergeMap,
171  of,
172  output,
173  pipe,
174  retryWhen,
175  setClassMetadata,
176  signal,
177  tap,
178  throwError,
179  untracked,
180  viewChild,
181  ɵsetClassDebugInfo,
182  ɵɵInheritDefinitionFeature,
183  ɵɵProvidersFeature,
184  ɵɵadvance,
185  ɵɵattribute,
186  ɵɵclassMap,
187  ɵɵclassProp,
188  ɵɵconditional,
189  ɵɵconditionalCreate,
190  ɵɵdeclareLet,
191  ɵɵdefineComponent,
192  ɵɵdefineInjectable,
193  ɵɵdirectiveInject,
194  ɵɵelement,
195  ɵɵelementEnd,
196  ɵɵelementStart,
197  ɵɵgetCurrentView,
198  ɵɵgetInheritedFactory,
199  ɵɵinject,
200  ɵɵinterpolate,
201  ɵɵinterpolate1,
202  ɵɵinterpolate2,
203  ɵɵlistener,
204  ɵɵnamespaceHTML,
205  ɵɵnamespaceSVG,
206  ɵɵnextContext,
207  ɵɵpipe,
208  ɵɵpipeBind1,
209  ɵɵpipeBind2,
210  ɵɵproperty,
211  ɵɵpureFunction1,
212  ɵɵpureFunction2,
213  ɵɵqueryAdvance,
214  ɵɵreadContextLet,
215  ɵɵreference,
216  ɵɵrepeater,
217  ɵɵrepeaterCreate,
218  ɵɵrepeaterTrackByIdentity,
219  ɵɵrepeaterTrackByIndex,
220  ɵɵresetView,
221  ɵɵrestoreView,
222  ɵɵsanitizeHtml,
223  ɵɵsanitizeUrl,
224  ɵɵstoreLet,
225  ɵɵstyleProp,
226  ɵɵtemplate,
227  ɵɵtemplateRefExtractor,
228  ɵɵtext,
229  ɵɵtextInterpolate,
230  ɵɵtextInterpolate1,
231  ɵɵtextInterpolate2,
232  ɵɵtextInterpolate4,
233  ɵɵtwoWayBindingSet,
234  ɵɵtwoWayListener,
235  ɵɵtwoWayProperty,
236  ɵɵviewQuerySignal
237} from "./chunk-TO7AEA7G.js";
238import {
239  __async,
240  __spreadProps,
241  __spreadValues
242} from "./chunk-CRZVVCMV.js";
243
244// libs/socialgest/messenger/src/infrastructure/notifications/instant-publication-summary-toast.component.ts
245var BORDER_COLOR = {
246  sending: "#0061FE",
247  "all-success": "#187B22",
248  "with-errors": "#C5414E"
249};
250var ICON = {
251  sending: "loader-2",
252  "all-success": "circle-check",
253  "with-errors": "circle-alert"
254};
255var InstantPublicationSummaryToastComponent = class _InstantPublicationSummaryToastComponent {
256  id = input.required();
257  message = input.required();
258  type = input.required();
259  borderColor = computed(() => BORDER_COLOR[this.type()]);
260  icon = computed(() => ICON[this.type()]);
261  close() {
262    toast.dismiss(this.id());
263  }
264  static \u0275fac = function InstantPublicationSummaryToastComponent_Factory(__ngFactoryType__) {
265    return new (__ngFactoryType__ || _InstantPublicationSummaryToastComponent)();
266  };
267  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _InstantPublicationSummaryToastComponent, selectors: [["app-instant-publication-summary-toast"]], inputs: { id: [1, "id"], message: [1, "message"], type: [1, "type"] }, decls: 8, vars: 7, consts: [[1, "instant-publication-toast", "h-full", "grid", "grid-cols-[auto_1fr_auto]", "items-center", "gap-4", "px-4", "py-3", "border-l-[0.8125rem]"], [1, "relative"], [1, "size-12", "rounded-full", "flex", "items-center", "justify-center", "bg-grey-100"], ["size", "24", 3, "name", "color"], [1, "flex", "flex-col", "gap-0.5", "min-w-0"], [1, "font-sans!", "text-grey-900!", "text-base!", "font-bold!", "break-words!"], ["name", "x", "size", "22", "color", "#73757B", 1, "cursor-pointer", 3, "click"]], template: function InstantPublicationSummaryToastComponent_Template(rf, ctx) {
268    if (rf & 1) {
269      \u0275\u0275elementStart(0, "section", 0)(1, "div", 1)(2, "span", 2);
270      \u0275\u0275element(3, "lucide-icon", 3);
271      \u0275\u0275elementEnd()();
272      \u0275\u0275elementStart(4, "div", 4)(5, "p", 5);
273      \u0275\u0275text(6);
274      \u0275\u0275elementEnd()();
275      \u0275\u0275elementStart(7, "lucide-icon", 6);
276      \u0275\u0275listener("click", function InstantPublicationSummaryToastComponent_Template_lucide_icon_click_7_listener() {
277        return ctx.close();
278      });
279      \u0275\u0275elementEnd()();
280    }
281    if (rf & 2) {
282      \u0275\u0275styleProp("border-left-color", ctx.borderColor());
283      \u0275\u0275advance(3);
284      \u0275\u0275classProp("spin-icon", ctx.type() === "sending");
285      \u0275\u0275property("name", ctx.icon())("color", ctx.borderColor());
286      \u0275\u0275advance(3);
287      \u0275\u0275textInterpolate1(" ", ctx.message(), " ");
288    }
289  }, dependencies: [LucideAngularModule, LucideAngularComponent], styles: ["/* angular:styles/component:css;ed71bcae0e25f322c6b567ce5c7f72419f483dd78665e69ec731bf1c1383e719;/codebuild/output/src3806768626/src/libs/socialgest/messenger/src/infrastructure/notifications/instant-publication-summary-toast.component.ts */\n[data-sonner-toast]:has(.instant-publication-toast) {\n  width: 100%;\n  border-radius: 0.625rem;\n  background-color: #fff;\n  box-shadow: 0 0.0625rem 1rem 0 #00000040;\n  overflow: hidden;\n}\n.instant-publication-toast .spin-icon {\n  animation: instant-publication-spin 1s linear infinite;\n}\n@keyframes instant-publication-spin {\n  from {\n    transform: rotate(0deg);\n  }\n  to {\n    transform: rotate(360deg);\n  }\n}\n"], encapsulation: 2 });
290};
291(() => {
292  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(InstantPublicationSummaryToastComponent, [{
293    type: Component,
294    args: [{ selector: "app-instant-publication-summary-toast", imports: [LucideAngularModule], encapsulation: ViewEncapsulation.None, template: `
295    <section
296      class="instant-publication-toast h-full grid grid-cols-[auto_1fr_auto] items-center gap-4 px-4 py-3 border-l-[0.8125rem]"
297      [style.borderLeftColor]="borderColor()"
298    >
299      <div class="relative">
300        <span
301          class="size-12 rounded-full flex items-center justify-center bg-grey-100"
302        >
303          <lucide-icon
304            [name]="icon()"
305            size="24"
306            [color]="borderColor()"
307            [class.spin-icon]="type() === 'sending'"
308          ></lucide-icon>
309        </span>
310      </div>
311      <div class="flex flex-col gap-0.5 min-w-0">
312        <p class="font-sans! text-grey-900! text-base! font-bold! break-words!">
313          {{ message() }}
314        </p>
315      </div>
316      <lucide-icon (click)="close()" name="x" size="22" color="#73757B" class="cursor-pointer"></lucide-icon>
317    </section>
318  `, styles: ["/* angular:styles/component:css;ed71bcae0e25f322c6b567ce5c7f72419f483dd78665e69ec731bf1c1383e719;/codebuild/output/src3806768626/src/libs/socialgest/messenger/src/infrastru
318cture/notifications/instant-publication-summary-toast.component.ts */\n[data-sonner-toast]:has(.instant-publication-toast) {\n  width: 100%;\n  border-radius: 0.625rem;\n  background-color: #fff;\n  box-shadow: 0 0.0625rem 1rem 0 #00000040;\n  overflow: hidden;\n}\n.instant-publication-toast .spin-icon {\n  animation: instant-publication-spin 1s linear infinite;\n}\n@keyframes instant-publication-spin {\n  from {\n    transform: rotate(0deg);\n  }\n  to {\n    transform: rotate(360deg);\n  }\n}\n"] }]
319  }], null, null);
320})();
321(() => {
322  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(InstantPublicationSummaryToastComponent, { className: "InstantPublicationSummaryToastComponent", filePath: "libs/socialgest/messenger/src/infrastructure/notifications/instant-publication-summary-toast.component.ts", lineNumber: 71 });
323})();
324
325// libs/socialgest/messenger/src/infrastructure/mappers/messenger/story.mapper.ts
326var StoryMapper = class {
327  static toRequest(post) {
328    if (post.publisher.is.instagram.story)
329      return PublicationType.STORY;
330    if (post.multimediaList.has.all.video)
331      return PublicationType.REEL;
332    return PublicationType.FEED;
333  }
334};
335
336// libs/socialgest/messenger/src/infrastructure/mappers/messenger/source.mapper.ts
337var SourceMapper = class {
338  static toRequest(post) {
339    if (post.is.instagram.story && (post.message.has.urls || post.options.instagram.location.isPresent)) {
340      return PublicationMethod.NOTIFICATION_PUSH;
341    }
342    return post.publisher.publicationMethod;
343  }
344};
345
346// libs/socialgest/messenger/src/infrastructure/mappers/messenger/type.mapper.ts
347var TypeMapper = class {
348  static toRequest(post) {
349    switch (post.status.status) {
350      case "none":
351        return 0;
352      case "programmed":
353        return 0;
354      case "published":
355        return 1;
356      case "failed":
357        return 2;
358      case "paused":
359        return 3;
360      case "toApproval":
361        return 4;
362      case "drafted":
363        return 5;
364      case "rejected":
365        return 7;
366      case "expired":
367        return 4;
368      case "idea":
369        return 10;
370      default:
371        throw new Error(`Invalid status ${post.status.status}`);
372    }
373  }
374};
375
376// libs/socialgest/messenger/src/infrastructure/mappers/messenger/action.mapper.ts
377var ActionMapper = class {
378  static toRequest(post) {
379    if (post.status.is.expired && !post.publisher.sendToApprove)
380      return MessengerActionType.SCHEDULE_ONCE;
381    if (post.status.is.rejected && !post.publisher.sendToApprove)
382      return MessengerActionType.SCHEDULE_ONCE;
383    if (post.status.is.toApproval && !post.publisher.sendToApprove)
384      return MessengerActionType.SCHEDULE_ONCE;
385    if (post.is.thread && !post.is.new)
386      return MessengerActionType.SCHEDULE_ONCE;
387    if (post.publisher.is.push && !post.is.new && post.publisher.sendToApprove)
388      return MessengerActionType.TO_APPROVAL;
389    if (post.publisher.is.push && !post.is.new)
390      return MessengerActionType.SCHEDULE_ONCE;
391    if (post.publisher.sendToApprove && !post.is.new)
392      return MessengerActionType.TO_APPROVAL;
393    if (post.status.isFailed)
394      return MessengerActionType.SCHEDULE_ONCE;
395    if (post.scheduler.is.present)
396      return MessengerActionType.SCHEDULE_SEVERAL_TIMES_SPECIFIC;
397    if (post.cyclic.isPresent)
398      return MessengerActionType.CYCLIC_LIST;
399    return MessengerActionType.SCHEDULE_ONCE;
400  }
401};
402
403// libs/socialgest/messenger/src/infrastructure/mappers/messenger/cover.mapper.ts
404var CoverMapper = class {
405  static toRequest(post) {
406    const cover = post.multimediaList.first?.cover;
407    const type = cover?.type?.includes("/") ? cover.type : `image/${cover?.type}`;
408    return cover ? __spreadProps(__spreadValues(__spreadValues({}, cover.toPrimitives()), cover.metadata.values), { id: null, type }) : null;
409  }
410};
411
412// libs/socialgest/messenger/src/infrastructure/mappers/messenger/places.mapper.ts
413var PlacesMapper = class {
414  static toRequest(post) {
415    if (post.options.instagram.location.isPresent || post.options.facebook.location.isPresent) {
416      return {
417        Fb: post.options.facebook.location.isPresent ? post.options.facebook.location.values : null,
418        Ig: post.options.instagram.location.isPresent ? post.options.instagram.location.values : null
419      };
420    }
421    return null;
422  }
423};
424
425// libs/socialgest/messenger/src/infrastructure/mappers/messenger/photos.mapper.ts
426var PhotosMapper = class {
427  static toRequest(post) {
428    const cover = post.multimediaList.first?.data["coverFrame"];
429    const photos = post.multimediaList.items.map((m) => {
430      const primitives = m.toPrimitives();
431      return __spreadProps(__spreadValues(__spreadValues({}, primitives), primitives.metadata.values), {
432        id: null,
433        thumbnail_second: cover || null,
434        alt_text: {
435          pt: m.altText ?? null,
436          lk: m.altText ?? null,
437          fb: m.altText ?? null,
438          tw: m.altText ?? null
439        }
440      });
441    });
442    if (post.userList.hasTelegram) {
443      photos.forEach((photo) => delete photo.alt_text);
444    }
445    return photos;
446  }
447};
448
449// libs/socialgest/messenger/src/infrastructure/mappers/messenger/tiktok-music.mapper.ts
450var TiktokMusicMapper = class {
451  static toRequest(post) {
452    if (!post.options.tiktok.has.music)
453      return null;
454    const music = post.options.tiktok.music;
455    return {
456      music_sound_id: music.id,
457      music_sound_volume: music.volume,
458      video_original_sound_volume: music.originalVolume,
459      music_sound_start: music.start,
460      music_sound_end: music.end,
461      music
462    };
463  }
464};
465
466// libs/socialgest/messenger/src/infrastructure/mappers/messenger/tiktok-location.mapper.ts
467var TiktokLocationMapper = class {
468  static toRequest(post) {
469    if (!post.options.tiktok.has.location)
470      return null;
471    const location = post.options.tiktok.location;
472    return {
473      location_id: location.id,
474      location_name: location.name
475    };
476  }
477};
478
479// libs/socialgest/messenger/src/infrastructure/mappers/messenger/instagram-audio.mapper.ts
480var InstagramAudioMapper = class {
481  static toRequest(post) {
482    if (!post.options.instagram.has.audio)
483      return null;
484    const audio = post.options.instagram.audio;
485    return {
486      audio_id: audio.id,
487      audio_volume: audio.volume,
488      video_volume: audio.originalVolume,
489      should_loop_audio: audio.shouldLoop,
490      audio
491    };
492  }
493};
494
495// libs/socialgest/messenger/src/infrastructure/mappers/messenger/collaborators.mapper.ts
496var CollaboratorsMapper = class {
497  static toRequest(post) {
498    return post.options.instagram.collaboratorList.items.map((c) => ({
499      id: c.id,
500      username: c.username,
501      photo: c.photo
502    }));
503  }
504};
505
506// libs/socialgest/messenger/src/infrastructure/mappers/messenger/mention.mapper.ts
507var MentionMapper = class {
508  static toRequest(post) {
509    let message = post.message.value;
510    for (const mention of post.options.instagram.mentionList.items) {
511      message = message.replace(new RegExp(`@${this.escapeRegex(mention.name)}(?![\\w\\d])`, "g"), `@[ig:@${mention.name}|ln:null|fb:null|gmb:null]`);
512    }
513    for (const mention of post.options.facebook.mentionList.items) {
514      message = message.replace(new RegExp(`@${this.escapeRegex(mention.name)}(?![\\w\\d])`, "g"), `@[fb:${mention.id},${mention.name}|ln:null|ig:null|gmb:null]`);
515    }
516    for (const mention of post.options.linkedin.mentionList.items) {
517      message = message.replace(new RegExp(`@${this.escapeRegex(mention.name)}(?![\\w\\d])`, "g"), `@[ln:${mention.id},${mention.name}|fb:null|ig:null|gmb:null]`);
518    }
519    return message;
520  }
521  static escapeRegex(str) {
522    return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
523  }
524};
525
526// libs/socialgest/messenger/src/infrastructure/mappers/messenger/thread.mapper.ts
527var ThreadMapper = class {
528  static toRequest(post) {
529    const mapMultimedia = (list) => list.items.map((m) => __spreadProps(__spreadValues(__spreadValues({}, m.toPrimitives()), m.metadata.values), {
530      id: null
531    }));
532    return post.threadPosts.items.map((tp) => ({
533      message: tp.message.trim(),
534      photos: mapMultimedia(tp.multimediaList),
535      photos2: mapMultimedia(tp.multimediaList),
536      places: {}
537    }));
538  }
539};
540
541// libs/socialgest/messenger/src/infrastructure/mappers/messenger/thumbnail-options.mapper.ts
542var ThumbnailOptionsMapper = class {
543  static toRequest(post) {
544    if (post.options.linkedin.has.pdf) {
545      return {
546        lk: {
547          index: 0,
548          title: post.multimediaList.first?.altText ?? "",
549          description: "",
550          hide_image: false
551        }
552      };
553    }
554    const linkPreview = post.linkPreview;
555    if (!linkPreview.has.any)
556      return null;
557    const index = linkPreview.image ? -1 : linkPreview.index;
558    const base = { index, title: linkPreview.title, description: linkPreview.description };
559    return {
560      fb: base,
561      lk: __spreadProps(__spreadValues({}, base), { hide_image: linkPreview.hideImage })
562    };
563  }
564};
565
566// libs/socialgest/messenger/src/infrastructure/mappers/messenger.mapper.ts
567var MessengerMapper = class _MessengerMapper {
568  store = inject(MessengerStore);
569  userStore = inject(UserStore);
570  linkStore = inject(linkStore);
571  toScheduleRequest(post = this.store.post()) {
572    const copy = post.copy();
573    copy.publisher.to.autoPost();
574    return __spreadValues({}, this.toBaseRequest(copy));
575  }
576  toDraftRequest(post = this.store.post()) {
577    return __spreadValues({}, this.toBaseRequest(post));
578  }
579  /**
580   * Shape for POST /api/v2/kanban/idea/store. The backend accepts the same
581   * body as draft_lambda so we reuse the base request; fields irrelevant to
582   * ideas (date, action, source method) are ignored server-side.
583   */
584  toIdeaRequest(post = this.store.post()) {
585    return __spreadValues({}, this.toBaseRequest(post));
586  }
587  toSendToApprovalRequest(post = this.store.post()) {
588    const copy = post.copy();
589    copy.publisher.to.sendToApprove(true);
590    return __spreadProps(__spreadValues({}, this.toBaseRequest(copy)), { send_to_approval: 1 });
591  }
592  toSendToPushRequest(post = this.store.post()) {
593    const copy = post.copy();
594    copy.publisher.to.push();
595    return __spreadProps(__spreadValues({}, this.toBaseRequest(copy)), { source: PublicationMethod.NOTIFICATION_PUSH });
596  }
597  toPublishNowRequest(post = this.store.post()) {
598    return __spreadProps(__spreadValues({}, this.toBaseRequest(post)), { action: MessengerActionType.INSTANT });
599  }
600  toUpdateRequest(post = this.store.post()) {
601    return this.toBaseRequest(post);
602  }
603  toBaseRequest(post) {
604    const isSpecific = post.scheduler.is.present;
605    const cover = post.multimediaList.first?.data["coverFrame"];
606    return {
607      action: ActionMapper.toRequest(post),
608      date: post.is.new ? $date(post.date).format.localDate() : $date(post.date).format.localDateTime(),
609      newdate: $date(post.scheduler.first.date).format.localDate(),
610      newhour: $date(post.scheduler.first.date).format.localTime(),
611      enddate: isSpecific ? post.scheduler.last.localDate() : null,
612      hours: isSpecific && post.is.new ? post.scheduler.toLocalDateTime() : [$date(post.date).format.localTime()],
613      days: isSpecific ? "1111111" : null,
614      manytimes_type: isSpecific ? 1 : null,
615      users: post.userList.ids.map(Number),
616      usercomplete: this.userStore.userList().ids.map(Number),
617      message: MentionMapper.toRequest(post),
618      campaign_id: post.campaign.isPresent ? Number(post.campaign.getId()) : null,
619      agent_chat_id: post.agentChatId ?? null,
620      cyclicid: post.cyclic.isPresent ? Number(post.cyclic.getId()) : null,
621      source: SourceMapper.toRequest(post),
622      posttags: [],
623      photos: PhotosMapper.toRequest(post),
624      sendnotifications: false,
625      album: "0",
626      story: StoryMapper.toRequest(post),
627      storyfb: post.publisher.publicationType.facebook,
628      convertVideo: post.publisher.hasTransformation ? 1 : 0,
629      type: TypeMapper.toRequest(post),
630      places: PlacesMapper.toRequest(post),
631      comment: post.options.instagram.firstComment.value || null,
632      first_comment: post.options.facebook.firstComment.isPresent ? { fb: post.options.facebook.firstComment.value } : null,
633      youtubeTitle: post.options.youtube.title || post.options.pinterest.title || null,
634      youtubeTags: post.options.youtube.tags,
635      youtubeVideoStatus: post.options.youtube.publicationMode,
636      youtubeCategoryId: post.options.youtube.category || null,
637      youtubeThumbnail: CoverMapper.toRequest(post),
638      cta_type: post.options.googleBusiness.ctaType,
639      cta_value: post.options.googleBusiness.ctaUrl || null,
640      urlpnt: post.options.pinterest.destLink || null,
641      alt_textpnt: post.options.pinterest.altText || null,
642      boardid: post.options.pinterest.boardId || null,
643      tweet_id: post.id || null,
644      usertaged: post.options.instagram.tagList.join(),
645      thumbnail_options: ThumbnailOptionsMapper.toRequest(post),
646      linkedinThumbnail: this.resolveLinkThumbnail(post),
647      options: {
648        topic: post.options.telegram.topic || null,
649        ig_reels_share_to_feed: true,
650        ig_reels_thumb_offset: cover ? convert.seg(cover).to.ms() : null,
651        tiktok_video_cover_timestamp_ms: cover ? convert.seg(cover).to.ms() : null,
652        tiktok_privacy_level: post.options.tiktok.visibility,
653        tiktok_disable_comment: !post.options.tiktok.allowComment,
654        tiktok_disable_duet: !post.options.tiktok.allowDuet,
655        tiktok_disable_stitch: !post.options.tiktok.allowStitch,
656        tiktok_disable_promoted: !post.options.tiktok.promoted,
657        custom_cover: CoverMapper.toRequest(post),
658        tiktok_music_sound_info: TiktokMusicMapper.toRequest(post),
659        tiktok_location: TiktokLocationMapper.toRequest(post),
660        ig_reels_audio_configuration: InstagramAudioMapper.toRequest(post),
661        ig_tagged_collaborators: CollaboratorsMapper.toRequest(post),
662        lk_pdf_carousel_url: post.options.linkedin.pdfUrl || null
663      },
664      thread: this.store.isThread().active ? ThreadMapper.toRequest(post) : null
665    };
666  }
667  resolveLinkThumbnail(post) {
668    const preview = post.linkPreview;
669    if (preview.image)
670      return preview.image;
671    if (preview.index <= 0)
672      return null;
673    const images = this.linkStore.link()?.images ?? [];
674    return images[preview.index] || null;
675  }
676  static \u0275fac = function MessengerMapper_Factory(__ngFactoryType__) {
677    return new (__ngFactoryType__ || _MessengerMapper)();
678  };
679  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _MessengerMapper, factory: _MessengerMapper.\u0275fac, providedIn: "root" });
680};
681(() => {
682  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MessengerMapper, [{
683    type: Injectable,
684    args: [{ providedIn: "root" }]
685  }], null, null);
686})();
687
688// libs/socialgest/messenger/src/infrastructure/mappers/errors/209.mapper.ts
689var Error209Mapper = class {
690  static from({ error }) {
691    const errorMessage = error?.data?.error_message;
692    if (!errorMessage)
693      return "";
694    if (Array.isArray(errorMessage) && errorMessage.length > 0) {
695      return errorMessage[0]?.message?.error?.message || errorMessage[0]?.message?.data?.message || errorMessage[0]?.message || "";
696    }
697    return errorMessage?.message || "";
698  }
699};
700
701// libs/socialgest/messenger/src/infrastructure/messenger-error.service.ts
702var MAP_ERRORS = {
703  3: () => "GLOBAL.ERROR.PERMISSION_DENIED",
704  64: () => "MESSENGER.ERROR.TWITTER_MAX_DIMENSION",
705  74: () => "MESSENGER.ERROR.VIDEO_TOO_SHORT",
706  303: () => "MESSENGER.ERROR.MESSAGE_FIELD_EMPTY",
707  309: () => "MESSENGER.ERROR.TWITTER_MAX_CHARS",
708  311: () => "MESSENGER.ERROR.TWITTER_MAX_IMAGES",
709  550: () => "MESSENGER.ERROR.TWITTER_THREAD_ONLY",
710  797: () => "MESSENGER.ERROR.TWITTER_DAY_INFO_UNAVAILABLE",
711  1075: () => "MESSENGER.ERROR.TWITTER_MAX_MEDIA",
712  1096: () => "MESSENGER.ERROR.TWITTER_VIDEO_LIMIT",
713  1109: () => "MESSENGER.ERROR.TWITTER_AUDIO_CODEC",
714  1110: () => "MESSENGER.ERROR.TWITTER_GIF_DIMENSION",
715  1111: () => "MESSENGER.ERROR.TWITTER_GIF_MAX_SIZE",
716  1313: () => "MESSENGER.ERROR.TWITTER_MAX_DIMENSION",
717  313: () => "MESSENGER.ERROR.INSTAGRAM_VERTICAL_ONLY",
718  318: () => "MESSENGER.ERROR.INSTAGRAM_MULTIPLE_TIMES",
719  340: () => "MESSENGER.ERROR.INSTAGRAM_BEST_TIME_FOLLOWERS",
720  410: () => "MESSENGER.ERROR.INSTAGRAM_STORIES_CYCLIC_ONLY",
721  1080: () => "MESSENGER.ERROR.INSTAGRAM_STORIES_SINGLE",
722  1081: () => "MESSENGER.ERROR.INSTAGRAM_STORIES_DIMENSION",
723  1085: () => "MESSENGER.ERROR.INSTAGRAM_VIDEO_DURATION",
724  1086: () => "MESSENGER.ERROR.INSTAGRAM_VIDEO_DIMENSION",
725  1087: () => "MESSENGER.ERROR.INSTAGRAM_STORIES_RESOLUTION",
726  1089: () => "MESSENGER.ERROR.INSTAGRAM_AUTH_REQUIRED",
727  1090: () => "MESSENGER.ERROR.INSTAGRAM_STORIES_VIDEO_DURATION",
728  1099: () => "MESSENGER.ERROR.INSTAGRAM_FREE_LIMIT",
729  1102: () => "MESSENGER.ERROR.INSTAGRAM_STORIES_MAX_FILES",
730  1104: () => "MESSENGER.ERROR.INSTAGRAM_API_NO_STORIES",
731  1105: () => "MESSENGER.ERROR.INSTAGRAM_API_SINGLE_MEDIA",
732  1106: () => "MESSENGER.ERROR.INSTAGRAM_API_VIDEO_LIMIT",
733  1108: () => "MESSENGER.ERROR.INSTAGRAM_STORIES_MAX_VIDEOS",
734  1500: () => "MESSENGER.ERROR.INSTAGRAM_BEST_TIME_FOLLOWERS",
735  1998: () => "MESSENGER.ERROR.INSTAGRAM_SQUARE_VIDEO",
736  1999: () => "MESSENGER.ERROR.INSTAGRAM_VIDEO_MAX_DIMENSION",
737  2e3: () => "MESSENGER.ERROR.INSTAGRAM_STORIES_VIDEO_DIMENSION",
738  2001: () => "MESSENGER.ERROR.INSTAGRAM_FRAMERATE",
739  2003: () => "MESSENGER.ERROR.INSTAGRAM_BITRATE_EXCEEDS",
740  2102: () => "MESSENGER.ERROR.INSTAGRAM_REELS_DURATION",
741  2103: () => "MESSENGER.ERROR.INSTAGRAM_REELS_DIMENSION",
742  2106: () => "MESSENGER.ERROR.INSTAGRAM_REELS_MULTIPLE_TIMES",
743  3120: () => "MESSENGER.ERROR.INSTAGRAM_THREADS_MAX_IMAGES",
744  3122: () => "MESSENGER.ERROR.INSTAGRAM_THREADS_IMAGE_SIZE",
745  413: () => "MESSENGER.ERROR.FACEBOOK_REELS_NO_CYCLIC",
746  1069: () => "MESSENGER.ERROR.FACEBOOK_MAX_IMAGES",
747  1082: () => "MESSENGER.ERROR.FACEBOOK_SINGLE_VIDEO",
748  1083: () => "MESSENGER.ERROR.FACEBOOK_STORIES_VIDEO_DURATION",
749  1103: () => "MESSENGER.ERROR.FACEBOOK_VIDEO_SIZE",
750  2002: () => "MESSENGER.ERROR.FACEBOOK_FRAMERATE",
751  310: () => "MESSENGER.ERROR.LINKEDIN_MIN_IMAGE",
752  1094: () => "MESSENGER.ERROR.LINKEDIN_VIDEO_LIMIT",
753  1095: () => "MESSENGER.ERROR.LINKEDIN_VIDEO_SIZE",
754  1098: () => "MESSENGER.ERROR.LINKEDIN_NO_PERSONAL_VIDEO",
755  1310: () => "MESSENGER.ERROR.LINKEDIN_NO_VIDEO_CAROUSEL",
756  1996: () => "MESSENGER.ERROR.LINKEDIN_VIDEO_DIMENSION",
757  1321: () => "MESSENGER.ERROR.TIKTOK_PUSH_ONLY",
758  1322: () => "MESSENGER.ERROR.TIKTOK_VIDEO_REQUIRED",
759  1324: () => "MESSENGER.ERROR.TIKTOK_VIDEO_TOO_SHORT",
760  1325: () => "MESSENGER.ERROR.TIKTOK_VIDEO_DIMENSION",
761  1326: () => "MESSENGER.ERROR.TIKTOK_FRAMERATE",
762  1328: () => "MESSENGER.ERROR.TIKTOK_VIDEO_DURATION",
763  1329: () => "MESSENGER.ERROR.TIKTOK_MIN_DIMENSION",
764  1330: () => "MESSENGER.ERROR.TIKTOK_FRAME_RATE",
765  1332: () => "MESSENGER.ERROR.TIKTOK_IMAGE_FORMAT",
766  1333: () => "MESSENGER.ERROR.TIKTOK_IMAGE_SIZE",
767  1334: () => "MESSENGER.ERROR.TIKTOK_IMAGE_WEIGHT",
768  1335: () => "MESSENGER.ERROR.TIKTOK_IMAGE_LENGTH",
769  1337: () => "MESSENGER.ERROR.TIKTOK_IMAGE_ASPECT",
770  328: () => "MESSENGER.ERROR.YOUTUBE_MAX_SIZE",
771  330: () => "MESSENGER.ERROR.GMB_MAX_PHOTOS",
772  331: () => "MESSENGER.ERROR.GMB_NO_VIDEO",
773  332: () => "MESSENGER.ERROR.GMB_MIN_DIMENSION",
774  333: () => "MESSENGER.ERROR.GMB_CTA_TYPE",
775  334: () => "MESSENGER.ERROR.GMB_CTA_URL",
776  6968: () => "MESSENGER.ERROR.GMB_NOT_AVAILABLE",
777  551: () => "MESSENGER.ERROR.THREADS_INSTANT_OR_SCHEDULED",
778  1076: () => "MESSENGER.ERROR.THREADS_NO_INSTANT",
779  208: () => "MESSENGER.ERROR.IMAGE_UPLOAD_FAILED",
780  302: () => "MESSENGER.ERROR.IMAGE_UPLOAD_FAILED",
781  304: () => "MESSENGER.ERROR.IMAGE_MAX_5000",
782  306: () => "MESSENGER.ERROR.IMAGE_MAX_5000",
783  324: () => "MESSENGER.ERROR.IMAGE_MAX_SIZE",
784  325: () => "MESSENGER.ERROR.IMAGE_MAX_SIZE",
785  326: () => "MESSENGER.ERROR.IMAGE_UPLOAD_MAX_SIZE",
786  1071: () => "MESSENGER.ERROR.IMAGE_SQUARE_REQUIRED",
787  1304: () => "MESSENGER.ERROR.IMAGE_MAX_2000",
788  3121: () => "MESSENGER.ERROR.IMAGE_INVALID_FORMAT",
789  3211: () => "MESSENGER.ERROR.IMAGE_SINGLE_FRAME",
790  1072: () => "MESSENGER.ERROR.VIDEO_CAROUSEL_NOT_ALLOWED",
791  1084: () => "MESSENGER.ERROR.VIDEO_MAX_15MB",
792  1092: () => "MESSENGER.ERROR.VIDEO_MAX_30MB",
793  1097: () => "MESSENGER.ERROR.VIDEO_INVALID_FRAMERATE",
794  3126: () => "MESSENGER.ERROR.VIDEO_INVALID_FRAMERATE",
795  91: () => "MESSENGER.ERROR.DATE_TOO_EARLY",
796  159: () => "MESSENGER.ERROR.BEST_TIME_INSUFFICIENT_DATA",
797  308: () => "MESSENGER.ERROR.FACEBOOK_ALBUM_REQUIRED",
798  314: () => "MESSENGER.ERROR.MULTIPLE_TIMES_REQUIRED",
799  315: () => "MESSENGER.ERROR.MULTIPLE_TIMES_SUCCESS_PARTIAL",
800  316: () => "MESSENGER.ERROR.DATES_NOT_DETECTED",
801  317: () => "MESSENGER.ERROR.DATE_EXCEEDS_PLAN",
802  319: () => "MESSENGER.ERROR.DUPLICATE_SCHEDULE",
803  390: () => "MESSENGER.ERROR.MULTIPLE_TIMES_INVALID_TIME",
804  402: () => "MESSENGER.ERROR.TWITTER_UPLOAD_FAILED",
805  407: () => "MESSENGER.ERROR.TWITTER_BLOCKED",
806  408: () => "MESSENGER.ERROR.TWITTER_BEST_TIME_ERROR",
807  433: () => "MESSENGER.ERROR.FILE_MAX_5MB",
808  504: () => "MESSENGER.ERROR.TIMEOUT",
809  1002: () => "MESSENGER.ERROR.MULTIPLE_TIMES_PLAN_REQUIRED",
810  1010: () => "MESSENGER.ERROR.RATE_LIMIT",
811  1045: () => "MESSENGER.ERROR.DATE_IN_PAST",
812  1078: () => "MESSENGER.ERROR.POST_NOT_EXISTS",
813  1079: () => "MESSENGER.ERROR.DATE_FORMAT_INVALID",
814  1101: () => "MESSENGER.ERROR.PUBLICATION_METHOD_UNAVAILABLE",
815  1409: () => "MESSENGER.ERROR.DATE_EXCEEDS_LIMIT",
816  1410: () => "MESSENGER.ERROR.THUMBNAIL_NOT_INSTANT",
817  7409: () => "MESSENGER.ERROR.MAX_TAGS",
818  7410: () => "MESSENGER.ERROR.TAGS_NOT_ALLOWED",
819  8888: () => "MESSENGER.ERROR.APPROVAL_ONLY_SCHEDULED",
820  1070: () => "MESSENGER.ERROR.PLAN_UPGRADE_REQUIRED",
821  1073: () => "MESSENGER.ERROR.ADDON_REQUIRED",
822  1074: () => "MESSENGER.ERROR.FREE_SINGLE_IMAGE",
823  1077: () => "MESSENGER.ERROR.FREE_NO_VIDEO_STORIES",
824  1088: () => "MESSENGER.ERROR.FREE_SCHEDULE_LIMIT",
825  1100: () => "MESSENGER.ERROR.FREE_NO_DRAFTS",
826  1116: () => "MESSENGER.ERROR.VIP_SCHEDULED_ONLY",
827  // Cupo de publicaciones con enlace en X agotado. El backend usa 1119 y no
828  // 402 a proposito: 402 ya esta tomado por TWITTER_UPLOAD_FAILED, y reusarlo
829  // le diria al cliente que fallo la subida en vez de que se quedo sin cupo.
830  1119: () => "MESSENGER.ERROR.NO_TWITTER_LINK_QUOTA",
831  1117: () => "MESSENGER.ERROR.MOCKUP_NO_INSTANT",
832  1118: () => "MESSENGER.ERROR.MOCKUP_NO_BEST_TIME",
833  343: () => "MESSENGER.ERROR.CAMPAIGN_DATE_OUTSIDE",
834  349: () => "MESSENGER.ERROR.CAMPAIGN_NOT_EXISTS",
835  4097: () => "MESSENGER.ERROR.TRY_AGAIN",
836  6969: () => "MESSENGER.ERROR.LIMIT_EXCEEDED",
837  209: (error) => Error209Mapper.from(error)
838};
839var from = (response) => {
840  return new Error(MAP_ERRORS[response.error?.meta?.code]?.(response) ?? "GLOBAL.ERROR.UNEXPECTED");
841};
842
843// libs/socialgest/messenger/src/infrastructure/retries/with-transformation.retry.ts
844var MAX_RETRIES = 3;
845var RETRYABLE_CODES = /* @__PURE__ */ new Set([
846  1093,
847  1998,
848  1999,
849  2e3,
850  1097,
851  2001,
852  2002,
853  2003,
854  1091,
855  1095,
856  1092,
857  1996,
858  1084,
859  1326,
860  2103,
861  1109,
862  3126,
863  1330,
864  324,
865  304,
866  325,
867  1304,
868  1110,
869  1111,
870  3211,
871  3122,
872  1337,
873  1333,
874  1334,
875  1332
876]);
877var isRetryable = (error) => {
878  const code = error?.error?.meta?.code;
879  return code !== void 0 && RETRYABLE_CODES.has(code);
880};
881var isRetryableCode = (code) => code !== void 0 && RETRYABLE_CODES.has(code);
882var withTransformationRetry = (post) => {
883  let retryCount = 0;
884  return pipe(mergeMap((error) => {
885    retryCount++;
886    if (!isRetryable(error) || retryCount > MAX_RETRIES)
887      return throwError(() => error);
888    return of(true).pipe(delay(retryCount * 1e3), tap(() => post.publisher.withTransformation()));
889  }));
890};
891
892// libs/socialgest/messenger/src/infrastructure/messenger.service.ts
893var MessengerService = class _MessengerService {
894  http;
895  apiUrl = `${environment.apiUrlV1}`;
896  store = inject(MessengerStore);
897  toaster = inject(SonnerToasterService);
898  mapper = inject(MessengerMapper);
899  translate = inject(TranslocoService);
900  constructor(http) {
901    this.http = http;
902  }
903  schedule(post) {
904    const delegate = this.store.delegate();
905    if (delegate?.updater)
906      return delegate.updater();
907    return defer(() => {
908      const method = post.is.new ? "post" : "put";
909      const url = post.is.new ? `${this.apiUrl}publications_lambda` : `${this.apiUrl}publications_lambda/${post.id}`;
910      return this.http[method](url, this.mapper.toScheduleRequest(post));
911    }).pipe(map(() => esm_exports.right(void 0)), retryWhen((errors) => errors.pipe(withTransformationRetry(post))), catchError((error) => of(esm_exports.left(from(error)))));
912  }
913  draft(post) {
914    return defer(() => {
915      return this.http.post(`${this.apiUrl}draft_lambda`, this.mapper.toDraftRequest(post));
916    }).pipe(map(() => esm_exports.right(void 0)), retryWhen((errors) => errors.pipe(withTransformationRetry(post))), catchError((error) => of(esm_exports.left(from(error)))));
917  }
918  /**
919   * Save the current post as a Kanban Idea (sent=10). Uses /store when the
920   * post is new and /update when it already has an id.
921   */
922  saveIdea(post) {
923    const apiV2 = environment.apiUrlV2;
924    return defer(() => {
925      const body = this.mapper.toIdeaRequest(post);
926      if (post.is.new) {
927        return this.http.post(`${apiV2}kanban/idea/store`, body);
928      }
929      return this.http.post(`${apiV2}kanban/idea/update`, __spreadProps(__spreadValues({}, body), { tweet_id: post.id }));
930    }).pipe(map(() => esm_exports.right(void 0)), retryWhen((errors) => errors.pipe(withTransformationRetry(post))), catchError((error) => of(esm_exports.left(from(error)))));
931  }
932  /**
933   * Delete a Kanban Idea by its publication (tweets_log) id, reusing the same
934   * endpoint the post "remove" action uses (DELETE /api/v1/publications/{id}).
935   * Used when an idea is promoted into a real post: the new publication is
936   * created first, then the original idea is removed so it doesn't stay
937   * duplicated in the Ideas column. The id is the tweets_log id (one per Kanban
938   * card), NOT the tweet id.
939   */
940  deleteIdea(publicationId) {
941    return this.http.delete(`${this.apiUrl}publications/${publicationId}`).pipe(map(() => esm_exports.right(void 0)), catchError((error) => of(esm_exports.left(from(error)))));
942  }
943  sendToApproval(post) {
944    return defer(() => {
945      const method = post.is.new ? "post" : "put";
946      const url = post.is.new ? `${this.apiUrl}publications_lambda` : `${this.apiUrl}publications_lambda/${post.id}`;
947      return this.http[method](url, this.mapper.toSendToApprovalRequest(post));
948    }).pipe(map(() => esm_exports.right(void 0)), retryWhen((errors) => errors.pipe(withTransformationRetry(post))), catchError((error) => of(esm_exports.left(from(error)))));
949  }
950  sendToPush(post) {
951    return defer(() => {
952      const method = post.is.new ? "post" : "put";
953      const url = post.is.new ? `${this.apiUrl}publications_lambda` : `${this.apiUrl}publications_lambda/${post.id}`;
954      return this.http[method](url, this.mapper.toSendToPushRequest(post));
955    }).pipe(map(() => esm_exports.right(void 0)), retryWhen((errors) => errors.pipe(withTransformationRetry(post))), catchError((error) => of(esm_exports.left(from(error)))));
956  }
957  publishNow(post) {
958    const userIds = post.userList.users.map((u) => Number(u.getId()));
959    const sendingId = "instant-pub-sending";
960    toast.custom(InstantPublicationSummaryToastComponent, {
961      id: sendingId,
962      componentProps: {
963        id: sendingId,
964        message: this.translate.translate("MESSENGER.INSTANT_PUBLICATION.SENDING_TOAST"),
965        type: "sending"
966      },
967      duration: 1e4
968    });
969    const singleRequests$ = userIds.map((userId) => defer(() => {
970      const singlePost = post.copy();
971      singlePost.set.userList(post.userList.filter((u) =>
971 Number(u.getId()) === userId));
972      return this.http.post(`${this.apiUrl}publications_lambda_async`, this.mapper.toPublishNowRequest(singlePost));
973    }).pipe(
974      // Si el HTTP falla para este user específico, convertimos el error en
975      // una entrada "error" en publications[] para que el mergeMap aguas abajo
976      // lo procese igual que un error controlado del backend. Así una red que
977      // falla a nivel de red/HTTP no tumba el forkJoin ni las demás redes.
978      catchError((error) => {
979        const code = error?.error?.meta?.code;
980        const publication = {
981          user_id: userId,
982          status: "error",
983          meta: code !== void 0 ? { code } : void 0
984        };
985        return of({
986          meta: { code: error?.status ?? 500 },
987          data: { publications: [publication] }
988        });
989      })
990    ));
991    return forkJoin(singleRequests$).pipe(mergeMap((responses) => {
992      const publications = responses.flatMap((r) => r?.data?.publications ?? []);
993      const retryableUserIds = publications.filter((p) => p.status === "error" && isRetryableCode(p.meta?.code)).map((p) => p.user_id);
994      const queuedCount = publications.filter((p) => p.status === "queued").length;
995      if (queuedCount > 0)
996        this.store.startInstantSending(queuedCount);
997      if (retryableUserIds.length === 0) {
998        return of(esm_exports.right(void 0));
999      }
1000      const failedPost = post.copy();
1001      const failedUserList = post.userList.filter((u) => retryableUserIds.includes(Number(u.getId())));
1002      failedPost.set.userList(failedUserList);
1003      failedPost.transform({ minutes: 5 });
1004      failedPost.reset.scheduler();
1005      this.toaster.info("MESSENGER.ALERTS.INSTANT_TO_PROGRAMMER");
1006      return this.schedule(failedPost);
1007    }), catchError((error) => {
1008      if (!isRetryable(error))
1009        return of(esm_exports.left(from(error)));
1010      const fallback = post.copy();
1011      fallback.transform({ minutes: 5 });
1012      fallback.reset.scheduler();
1013      this.toaster.info("MESSENGER.ALERTS.INSTANT_TO_PROGRAMMER");
1014      return this.schedule(fallback);
1015    }));
1016  }
1017  update(post) {
1018    const delegate = this.store.delegate();
1019    if (delegate?.updater)
1020      return delegate.updater();
1021    return defer(() => {
1022      return this.http.put(`${this.apiUrl}publications_lambda/${post.id}`, this.mapper.toUpdateRequest(post));
1023    }).pipe(map(() => esm_exports.right(void 0)), retryWhen((errors) => errors.pipe(withTransformationRetry(post))), catchError((error) => of(esm_exports.left(from(error)))));
1024  }
1025  static \u0275fac = function MessengerService_Factory(__ngFactoryType__) {
1026    return new (__ngFactoryType__ || _MessengerService)(\u0275\u0275inject(HttpClient));
1027  };
1028  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _MessengerService, factory: _MessengerService.\u0275fac, providedIn: "root" });
1029};
1030(() => {
1031  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MessengerService, [{
1032    type: Injectable,
1033    args: [{ providedIn: "root" }]
1034  }], () => [{ type: HttpClient }], null);
1035})();
1036
1037// libs/socialgest/messenger/src/infrastructure/instant-publication-socket.service.ts
1038var InstantPublicationSocketService = class _InstantPublicationSocketService {
1039  socket = inject(WrappedSocket);
1040  listen() {
1041    this.socket.on("tikket.publication.instant.status", (raw) => {
1042      console.log("[InstantPublicationSocket] tikket.publication.instant.status", raw);
1043      const data = raw.data;
1044      if (data.status === "publishing")
1045        bus.publish(new PostInstantPublishingEvent(data));
1046      else if (data.status === "success")
1047        bus.publish(new PostInstantPublishSucceededEvent(data));
1048      else if (data.status === "error")
1049        bus.publish(new PostInstantPublishFailedEvent(data));
1050    });
1051  }
1052  stopListening() {
1053    this.socket.removeListener("tikket.publication.instant.status");
1054  }
1055  static \u0275fac = function InstantPublicationSocketService_Factory(__ngFactoryType__) {
1056    return new (__ngFactoryType__ || _InstantPublicationSocketService)();
1057  };
1058  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _InstantPublicationSocketService, factory: _InstantPublicationSocketService.\u0275fac, providedIn: "root" });
1059};
1060(() => {
1061  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(InstantPublicationSocketService, [{
1062    type: Injectable,
1063    args: [{ providedIn: "root" }]
1064  }], null, null);
1065})();
1066
1067// libs/socialgest/messenger/src/infrastructure/notifications/instant-publication-toast.component.ts
1068var _c0 = (a0) => ({ network: a0 });
1069function InstantPublicationToastComponent_Conditional_9_Template(rf, ctx) {
1070  if (rf & 1) {
1071    \u0275\u0275elementStart(0, "p", 7);
1072    \u0275\u0275text(1);
1073    \u0275\u0275elementEnd();
1074  }
1075  if (rf & 2) {
1076    const ctx_r0 = \u0275\u0275nextContext();
1077    \u0275\u0275advance();
1078    \u0275\u0275textInterpolate(ctx_r0.subtitle());
1079  }
1080}
1081function InstantPublicationToastComponent_Conditional_10_Template(rf, ctx) {
1082  if (rf & 1) {
1083    \u0275\u0275elementStart(0, "p", 8);
1084    \u0275\u0275text(1);
1085    \u0275\u0275elementEnd();
1086  }
1087  if (rf & 2) {
1088    const ctx_r0 = \u0275\u0275nextContext();
1089    \u0275\u0275advance();
1090    \u0275\u0275textInterpolate1(" ", ctx_r0.payload().result.error_message, " ");
1091  }
1092}
1093var TITLE_KEY_BY_STATUS = {
1094  publishing: "MESSENGER.INSTANT_PUBLICATION.PUBLISHING",
1095  success: "MESSENGER.INSTANT_PUBLICATION.SUCCESS",
1096  error: "MESSENGER.INSTANT_PUBLICATION.ERROR_TITLE"
1097};
1098var BORDER_COLOR_BY_STATUS = {
1099  publishing: "#0061FE",
1100  success: "#187B22",
1101  error: "#C5414E"
1102};
1103var STATUS_ICON_BY_STATUS = {
1104  publishing: "loader-2",
1105  success: "circle-check",
1106  error: "circle-x"
1107};
1108var InstantPublicationToastComponent = class _InstantPublicationToastComponent {
1109  id = input.required();
1110  payload = input.required();
1111  status = input.required();
1112  networkLabel = computed(() => getInstantPublicationNetworkLabel(this.payload().network.type_name));
1113  avatarLabel = computed(() => {
1114    const username = this.payload().network.username;
1115    return username && username.trim().length > 0 ? username : this.networkLabel();
1116  });
1117  // Segunda línea del toast: si hay username lo muestra como @handle.
1118  // Si no (ej: Facebook pages), muestra la red + account_id para que el
1119  // usuario sepa qué cuenta exacta de varias posibles del mismo tipo publicó.
1120  subtitle = computed(() => {
1121    const username = this.payload().network.username;
1122    if (username && username.trim().length > 0)
1123      return `@${username}`;
1124    return null;
1125  });
1126  titleKey = computed(() => TITLE_KEY_BY_STATUS[this.status()]);
1127  borderColor = computed(() => BORDER_COLOR_BY_STATUS[this.status()]);
1128  statusIcon = computed(() => STATUS_ICON_BY_STATUS[this.status()]);
1129  close() {
1130    toast.dismiss(this.id());
1131  }
1132  static \u0275fac = function InstantPublicationToastComponent_Factory(__ngFactoryType__) {
1133    return new (__ngFactoryType__ || _InstantPublicationToastComponent)();
1134  };
1135  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _InstantPublicationToastComponent, selectors: [["app-instant-publication-toast"]], inputs: { id: [1, "id"], payload: [1, "payload"], status: [1, "status"] }, decls: 12, vars: 17, consts: [[1, "instant-publication-toast", "h-full", "grid", "grid-cols-[auto_1fr_auto]", "items-center", "gap-4", "px-4", "py-3", "border-l-[0.8125rem]"], [1, "relative"], ["size", "large", 3, "image", "label"], [1, "absolute", "-bottom-1", "-right-1", "size-5", "rounded-full", "flex", "items-center", "justify-center"], ["size", "14", "color", "#ffffff", 3, "name"], [1, "flex", "flex-col", "gap-0.5", "min-w-0"], [1, "font-sans!", "text-grey-900!", "text-base!", "font-bold!", "break-words!"], [1, "font-sans!", "text-grey-700!", "text-sm!", "font-medium!", "truncate!"], [1, "font-sans!", "text-red-600!", "text-xs!", "font-medium!", "break-words!"], ["name", "x", "size", "22", "color", "#73757B", 1, "cursor-pointer", 3, "click"]], template: function InstantPublicationToastComponent_Template(rf, ctx) {
1136    if (rf & 1) {
1137      \u0275\u0275elementStart(0, "section", 0)(1, "div", 1);
1138      \u0275\u0275element(2, "ui-avatar", 2);
1139      \u0275\u0275elementStart(3, "span", 3);
1140      \u0275\u0275element(4, "lucide-icon", 4);
1141      \u0275\u0275elementEnd()();
1142      \u0275\u0275elementStart(5, "div", 5)(6, "p", 6);
1143      \u0275\u0275text(7);
1144      \u0275\u0275pipe(8, "translate");
1145      \u0275\u0275elementEnd();
1146      \u0275\u0275conditionalCreate(9, InstantPublicationToastComponent_Conditional_9_Template, 2, 1, "p", 7);
1147      \u0275\u0275conditionalCreate(10, InstantPublicationToastComponent_Conditional_10_Template, 2, 1, "p", 8);
1148      \u0275\u0275elementEnd();
1149      \u0275\u0275elementStart(11, "lucide-icon", 9);
1150      \u0275\u0275listener("click", function InstantPublicationToastComponent_Template_lucide_icon_click_11_listener() {
1151        return ctx.close();
1152      });
1153      \u0275\u0275elementEnd()();
1154    }
1155    if (rf & 2) {
1156      \u0275\u0275styleProp("border-left-color", ctx.borderColor());
1157      \u0275\u0275advance(2);
1158      \u0275\u0275property("image", ctx.payload().network.photo ?? "")("label", ctx.avatarLabel());
1159      \u0275\u0275advance();
1160      \u0275\u0275styleProp("background-color", ctx.borderColor());
1161      \u0275\u0275advance();
1162      \u0275\u0275classProp("spin-icon", ctx.status() === "publishing");
1163      \u0275\u0275property("name", ctx.statusIcon());
1164      \u0275\u0275advance(3);
1165      \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind2(8, 12, ctx.titleKey(), \u0275\u0275pureFunction1(15, _c0, ctx.networkLabel())), " ");
1166      \u0275\u0275advance(2);
1167      \u0275\u0275conditional(ctx.subtitle() ? 9 : -1);
1168      \u0275\u0275advance();
1169      \u0275\u0275conditional(ctx.status() === "error" && ctx.payload().result.error_message ? 10 : -1);
1170    }
1171  }, dependencies: [LucideAngularModule, LucideAngularComponent, TranslatePipe, AvatarComponent], styles: ["/* angular:styles/component:css;ed71bcae0e25f322c6b567ce5c7f72419f483dd78665e69ec731bf1c1383e719;/codebuild/output/src3806768626/src/libs/socialgest/messenger/src/infrastru
1171cture/notifications/instant-publication-toast.component.ts */\n[data-sonner-toast]:has(.instant-publication-toast) {\n  width: 100%;\n  border-radius: 0.625rem;\n  background-color: #fff;\n  box-shadow: 0 0.0625rem 1rem 0 #00000040;\n  overflow: hidden;\n}\n.instant-publication-toast .spin-icon {\n  animation: instant-publication-spin 1s linear infinite;\n}\n@keyframes instant-publication-spin {\n  from {\n    transform: rotate(0deg);\n  }\n  to {\n    transform: rotate(360deg);\n  }\n}\n"], encapsulation: 2 });
1172};
1173(() => {
1174  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(InstantPublicationToastComponent, [{
1175    type: Component,
1176    args: [{ selector: "app-instant-publication-toast", imports: [LucideAngularModule, TranslatePipe, AvatarComponent], encapsulation: ViewEncapsulation.None, template: `
1177    <section
1178      class="instant-publication-toast h-full grid grid-cols-[auto_1fr_auto] items-center gap-4 px-4 py-3 border-l-[0.8125rem]"
1179      [style.borderLeftColor]="borderColor()"
1180    >
1181      <div class="relative">
1182        <ui-avatar [image]="payload().network.photo ?? ''" [label]="avatarLabel()" size="large" />
1183        <span
1184          class="absolute -bottom-1 -right-1 size-5 rounded-full flex items-center justify-center"
1185          [style.backgroundColor]="borderColor()"
1186        >
1187          <lucide-icon
1188            [name]="statusIcon()"
1189            size="14"
1190            color="#ffffff"
1191            [class.spin-icon]="status() === 'publishing'"
1192          ></lucide-icon>
1193        </span>
1194      </div>
1195      <div class="flex flex-col gap-0.5 min-w-0">
1196        <p class="font-sans! text-grey-900! text-base! font-bold! break-words!">
1197          {{ titleKey() | translate: { network: networkLabel() } }}
1198        </p>
1199        @if (subtitle()) {
1200          <p class="font-sans! text-grey-700! text-sm! font-medium! truncate!">{{ subtitle() }}</p>
1201        }
1202        @if (status() === 'error' && payload().result.error_message) {
1203          <p
1204            class="font-sans! text-red-600! text-xs! font-medium! break-words!"
1205          >
1206            {{ payload().result.error_message }}
1207          </p>
1208        }
1209      </div>
1210      <lucide-icon (click)="close()" name="x" size="22" color="#73757B" class="cursor-pointer"></lucide-icon>
1211    </section>
1212  `, styles: ["/* angular:styles/component:css;ed71bcae0e25f322c6b567ce5c7f72419f483dd78665e69ec731bf1c1383e719;/codebuild/output/src3806768626/src/libs/socialgest/messenger/src/infrastructure/notifications/instant-publication-toast.component.ts */\n[data-sonner-toast]:has(.instant-publication-toast) {\n  width: 100%;\n  border-radius: 0.625rem;\n  background-color: #fff;\n  box-shadow: 0 0.0625rem 1rem 0 #00000040;\n  overflow: hidden;\n}\n.instant-publication-toast .spin-icon {\n  animation: instant-publication-spin 1s linear infinite;\n}\n@keyframes instant-publication-spin {\n  from {\n    transform: rotate(0deg);\n  }\n  to {\n    transform: rotate(360deg);\n  }\n}\n"] }]
1213  }], null, null);
1214})();
1215(() => {
1216  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(InstantPublicationToastComponent, { className: "InstantPublicationToastComponent", filePath: "libs/socialgest/messenger/src/infrastructure/notifications/instant-publication-toast.component.ts", lineNumber: 92 });
1217})();
1218
1219// libs/socialgest/messenger/src/infrastructure/messenger.subscriber.ts
1220var MessengerSubscriber = class _MessengerSubscriber extends BaseSubscriber {
1221  messengerService = inject(MessengerService2);
1222  messengerHttp = inject(MessengerService);
1223  instantPublicationSocket = inject(InstantPublicationSocketService);
1224  messengerStore = inject(MessengerStore);
1225  confirmDialog = inject(ConfirmDialogService);
1226  translate = inject(TranslocoService);
1227  toaster = inject(SonnerToasterService);
1228  constructor() {
1229    super();
1230  }
1231  listen() {
1232    this.instantPublicationSocket.listen();
1233    this.bus.on(PostUpdateEvent).subscribe((event) => this.onPostUpdate(event));
1234    this.bus.on(PostReuseEvent).subscribe((event) => this.onPostReuse(event));
1235    this.bus.onMany([
1236      PostScheduledEvent,
1237      PostSentToPushEvent,
1238      PostDraftedEvent,
1239      PostSentToApprovalEvent,
1240      PostUpdatedEvent
1241    ]).subscribe((event) => this.onPostCompleted(event));
1242    this.bus.on(PostPublishedNowEvent).subscribe(() => this.deletePromotedIdeaIfAny());
1243    this.bus.on(PostInstantPublishingEvent).subscribe(({ payload }) => this.onInstantPublishing(payload));
1244    this.bus.on(PostInstantPublishSucceededEvent).subscribe(({ payload }) => this.onInstantSuccess(payload));
1245    this.bus.on(PostInstantPublishFailedEvent).subscribe(({ payload }) => this.onInstantFailure(payload));
1246  }
1247  onPostUpdate({ post }) {
1248    this.messengerService.open(post.copy());
1249  }
1250  onPostReuse({ post }) {
1251    const reusePost = post.copy().withoutId();
1252    reusePost.reset.scheduler();
1253    this.messengerService.open(reusePost);
1254  }
1255  onPostCompleted({ post }) {
1256    this.deletePromotedIdeaIfAny();
1257    this.bus.publish(new PostCompletedEvent(post));
1258  }
1259  deletePromotedIdeaIfAny() {
1260    const ideaTweetId = this.messengerStore.promotedFromIdeaId();
1261    if (!ideaTweetId)
1262      return;
1263    this.messengerStore.clearPromotedFromIdea();
1264    this.messengerHttp.deleteIdea(ideaTweetId).subscribe((result) => {
1265      result.mapRight(() => this.bus.publish(new PostIdeaDeletedEvent(ideaTweetId)));
1266    });
1267  }
1268  showRichToast(payload, status) {
1269    toast.dismiss("instant-pub-sending");
1270    const base = `instant-publication-${payload.tweet_log_id}`;
1271    toast.dismiss(`${base}-publishing`);
1272    if (status !== "error")
1273      toast.dismiss(`${base}-error`);
1274    if (status !== "success")
1275      toast.dismiss(`${base}-success`);
1276    const id = `${base}-${status}`;
1277    toast.custom(InstantPublicationToastComponent, {
1278      id,
1279      componentProps: { id, payload, status },
1280      duration: status === "success" ? 1e4 : Number.POSITIVE_INFINITY
1281    });
1282  }
1283  onInstantPublishing(payload) {
1284    this.showRichToast(payload, "publishing");
1285  }
1286  successCount = 0;
1287  errorCount = 0;
1288  onInstantSuccess(payload) {
1289    this.showRichToast(payload, "success");
1290    this.successCount++;
1291    this.messengerStore.removeInstantUser(payload.network.user_id
1291);
1292    this.messengerStore.decrementInstantPending();
1293    this.checkAllDone();
1294  }
1295  onInstantFailure(payload) {
1296    this.showRichToast(payload, "error");
1297    this.errorCount++;
1298    this.confirmDialog.close();
1299    this.messengerStore.decrementInstantPending();
1300    this.checkAllDone();
1301  }
1302  checkAllDone() {
1303    if (this.messengerStore.pendingInstantCount() > 0)
1304      return;
1305    this.messengerStore.endInstantSending();
1306    if (this.errorCount > 0) {
1307      this.showSummaryToast();
1308    }
1309    this.successCount = 0;
1310    this.errorCount = 0;
1311  }
1312  showSummaryToast() {
1313    const message = this.translate.translate("MESSENGER.INSTANT_PUBLICATION.SUMMARY_WITH_ERRORS", {
1314      success: this.successCount,
1315      errors: this.errorCount
1316    });
1317    const id = `instant-pub-summary-${Date.now()}`;
1318    toast.custom(InstantPublicationSummaryToastComponent, {
1319      id,
1320      componentProps: { id, message, type: "with-errors" },
1321      duration: Number.POSITIVE_INFINITY
1322    });
1323  }
1324  static \u0275fac = function MessengerSubscriber_Factory(__ngFactoryType__) {
1325    return new (__ngFactoryType__ || _MessengerSubscriber)();
1326  };
1327  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _MessengerSubscriber, factory: _MessengerSubscriber.\u0275fac, providedIn: "root" });
1328};
1329(() => {
1330  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MessengerSubscriber, [{
1331    type: Injectable,
1332    args: [{ providedIn: "root" }]
1333  }], () => [], null);
1334})();
1335
1336// libs/socialgest/messenger/src/infrastructure/messenger-personalized.service.ts
1337var MessengerPersonalizedService = class _MessengerPersonalizedService {
1338  store = inject(MessengerStore);
1339  get map() {
1340    return this.store.personalized().map;
1341  }
1342  get isEnabled() {
1343    return this.store.personalized().active;
1344  }
1345  enable() {
1346    const map2 = this.store.post().buildPersonalizedMap();
1347    const thread = this.store.thread();
1348    for (const key of Object.keys(map2)) {
1349      const type = Number(key);
1350      const keepThreads = type === UserType.X && thread.x.active || type === UserType.THREADS && thread.threads.active;
1351      if (!keepThreads)
1352        map2[key].threadPosts = ThreadPostList.empty();
1353    }
1354    this.store.withPersonalized({ active: true, map: map2 });
1355  }
1356  disable() {
1357    this.saveCurrentTab();
1358    const firstType = this.store.post().userList.types[0];
1359    const firstData = firstType !== void 0 ? this.store.personalized().map[String(firstType)] : void 0;
1360    this.store.disableThread(UserType.X);
1361    this.store.disableThread(UserType.THREADS);
1362    const post = this.store.post();
1363    if (firstData) {
1364      post.set.message(firstData.message);
1365      post.set.multimediaList(firstData.multimediaList.copy());
1366      if (firstData.options) {
1367        post.set.options(post.options.withFor(firstType, firstData.options));
1368      }
1369    } else {
1370      post.set.message("");
1371      post.set.multimediaList(MultimediaList.empty());
1372    }
1373    post.set.threadPosts(ThreadPostList.empty());
1374    this.store.withPost(post.copy());
1375    this.store.withPersonalized({ active: false, map: {} });
1376  }
1377  saveCurrentTab() {
1378    const userType = this.store.userType();
1379    if (userType === UserType.NONE)
1380      return;
1381    const personalized = this.store.personalized();
1382    const post = this.store.post();
1383    this.store.withPersonalized(__spreadProps(__spreadValues({}, personalized), {
1384      map: __spreadProps(__spreadValues({}, personalized.map), {
1385        [String(userType)]: {
1386          message: post.message.value,
1387          multimediaList: post.multimediaList.copy(),
1388          threadPosts: post.threadPosts.copy(),
1389          options: post.options.copyFor(userType)
1390        }
1391      })
1392    }));
1393  }
1394  loadTab(userType) {
1395    const data = this.store.personalized().map[String(userType)];
1396    const post = this.store.post();
1397    post.set.message(data?.message ?? "");
1398    post.set.multimediaList(data ? data.multimediaList.copy() : MultimediaList.empty());
1399    post.set.threadPosts(data ? data.threadPosts.copy() : ThreadPostList.empty());
1400    if (data?.options) {
1401      post.set.options(post.options.withFor(userType, data.options));
1402    }
1403    this.store.withPost(post.copy());
1404  }
1405  static \u0275fac = function MessengerPersonalizedService_Factory(__ngFactoryType__) {
1406    return new (__ngFactoryType__ || _MessengerPersonalizedService)();
1407  };
1408  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _MessengerPersonalizedService, factory: _MessengerPersonalizedService.\u0275fac, providedIn: "root" });
1409};
1410(() => {
1411  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MessengerPersonalizedService, [{
1412    type: Injectable,
1413    args: [{ providedIn: "root" }]
1414  }], null, null);
1415})();
1416
1417// libs/socialgest/messenger/src/infrastructure/ai/ai-error.service.ts
1418var MAP_ERRORS2 = {
1419  401: "MESSENGER.ERROR.PAID_PLAN_ONLY",
1420  402: "CYCLIC_LIST.ERROR.AI_NO_CREDITS",
1421  410: "MESSENGER.ERROR.NOT_FOUND_POSTS_FOR_BEST_DATETIME",
1422  411: "MESSENGER.ERROR.ERROR_ON_BEST_TIMES_ANALYSIS"
1423};
1424var from2 = (response) => {
1425  const creditReason = creditGateErrorKey(response);
1426  if (creditReason)
1427    return new Exception(creditReason);
1428  return new Exception(MAP_ERRORS2[response.error?.meta?.code] ?? "GLOBAL.ERROR.UNEXPECTED");
1429};
1430
1431// libs/socialgest/messenger/src/infrastructure/ai/ai.service.ts
1432var AiService = class _AiService {
1433  http;
1434  constructor(http) {
1435    this.http = http;
1436  }
1437  getBestDatetime(post) {
1438    return this.http.get(`${environment.apiUrlV1}ia/best_datetime`, {
1439      params: { users: post.userList.ids.join(",") }
1440    }).pipe(map((response) => esm_exports.right(response.data.best_times.map((date) => new Date(date)))), catchError((error) => of(esm_exports.left(from2(error)))));
1441  }
1442  static \u0275fac = function AiService_Factory(__ngFactoryType__) {
1443    return new (__ngFactoryType__ || _AiService)(\u0275\u0275inject(HttpClient));
1444  };
1445  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _AiService, factory: _AiService.\u0275fac, providedIn: "root" });
1446};
1447(() => {
1448  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(AiService, [{
1449    type: Injectable,
1450    args: [{ providedIn: "root" }]
1451  }], () => [{ type: HttpClient }], null);
1452})();
1453
1454// libs/socialgest/messenger/src/infrastructure/converters/mov-conversion.service.ts
1455var MovConversionService = class _MovConversionService {
1456  http;
1457  constructor(http) {
1458    this.http = http;
1459  }
1460  convert(url) {
1461    return this.http.post(`${environment.apiUrlV1}convert_mediafile_sync`, { url }).pipe(map((response) => esm_exports.right(response.data.file)), catchError((error) => of(esm_exports.left(new Error(error.message)))));
1462  }
1463  static \u0275fac = function MovConversionService_Factory(__ngFactoryType__) {
1464    return new (__ngFactoryType__ || _MovConversionService)(\u0275\u0275inject(HttpClient));
1465  };
1466  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _MovConversionService, factory: _MovConversionService.\u0275fac, providedIn: "root" });
1467};
1468(() => {
1469  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MovConversionService, [{
1470    type: Injectable,
1471    args: [{ providedIn: "root" }]
1472  }], () => [{ type: HttpClient }], null);
1473})();
1474
1475// libs/socialgest/messenger/src/infrastructure/converters/mov-conversion.handler.ts
1476var MovConversionHandler = class _MovConversionHandler {
1477  conversionService = inject(MovConversionService);
1478  store = inject(MessengerStore);
1479  converting = /* @__PURE__ */ new Set();
1480  handle(multimedia) {
1481    return __async(this, null, function* () {
1482      const originalUrl = multimedia.url;
1483      if (this.converting.has(originalUrl))
1484        return;
1485      this.converting.add(originalUrl);
1486      multimedia.to.loading();
1487      this.store.refresh();
1488      try {
1489        const result = yield lastValueFrom(this.conversionService.convert(originalUrl));
1490        const items = this.store.post().multimediaList.items;
1491        const index = items.findIndex((m) => m.url === originalUrl);
1492        if (index === -1)
1493          return;
1494        if (result.isRight()) {
1495          try {
1496            const converted = new Multimedia(result.value);
1497            yield converted.metadata.load();
1498            items.splice(index, 1, converted);
1499          } catch {
1500            items[index]?.to.error({ code: "MOV_CONVERSION_FAILED" });
1501          }
1502        } else {
1503          items[index]?.to.error({ code: "MOV_CONVERSION_FAILED" });
1504        }
1505        this.store.refresh();
1506      } finally {
1507        this.converting.delete(originalUrl);
1508      }
1509    });
1510  }
1511  reset() {
1512    this.converting.clear();
1513  }
1514  static \u0275fac = function MovConversionHandler_Factory(__ngFactoryType__) {
1515    return new (__ngFactoryType__ || _MovConversionHandler)();
1516  };
1517  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _MovConversionHandler, factory: _MovConversionHandler.\u0275fac, providedIn: "root" });
1518};
1519(() => {
1520  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MovConversionHandler, [{
1521    type: Injectable,
1522    args: [{ providedIn: "root" }]
1523  }], null, null);
1524})();
1525
1526// libs/socialgest/messenger/src/infrastructure/converters/mov-conversion.subscriber.ts
1527var MovConversionSubscriber = class _MovConversionSubscriber {
1528  store = inject(MessengerStore);
1529  handler = inject(MovConversionHandler);
1530  initialized = signal(false);
1531  init() {
1532    if (this.initialized())
1533      return;
1534    this.initialized.set(true);
1535    effect(() => {
1536      this.store.post().multimediaList.items.filter((m) => m.isMov() && m.isOk()).forEach((m) => this.handler.handle(m));
1537    });
1538  }
1539  reset() {
1540    this.handler.reset();
1541  }
1542  static \u0275fac = function MovConversionSubscriber_Factory(__ngFactoryType__) {
1543    return new (__ngFactoryType__ || _MovConversionSubscriber)();
1544  };
1545  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _MovConversionSubscriber, factory: _MovConversionSubscriber.\u0275fac, providedIn: "root" });
1546};
1547(() => {
1548  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MovConversionSubscriber, [{
1549    type: Injectable,
1550    args: [{ providedIn: "root" }]
1551  }], null, null);
1552})();
1553
1554// libs/socialgest/messenger/src/infrastructure/shortener/socialgest/socialgest-shortener-error.service.ts
1555var MAP_ERRORS3 = {
1556  412: "MESSENGER.SHORTENER.ERRORS.INVALID_URL",
1557  409: "MESSENGER.SHORTENER.ERRORS.INVALID_URL",
1558  410: "MESSENGER.SHORTENER.ERRORS.CUSTOM_LINK_ALREADY_TAKEN",
1559  404: "MESSENGER.SHORTENER.ERRORS.NEED_USERS"
1560};
1561var SocialgestShortenerErrorService = class _SocialgestShortenerErrorService {
1562  from(response) {
1563    const error = response?.error;
1564    if (error?.message === "error in permissions") {
1565      return new Error("MESSENGER.SHORTENER.ERRORS.ACCOUNT_PREMIUM");
1566    }
1567    return new Error(MAP_ERRORS3[error?.meta?.code] ?? "GLOBAL.ERROR.UNEXPECTED");
1568  }
1569  static \u0275fac = function SocialgestShortenerErrorService_Factory(__ngFactoryType__) {
1570    return new (__ngFactoryType__ || _SocialgestShortenerErrorService)();
1571  };
1572  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _SocialgestShortenerErrorService, factory: _SocialgestShortenerErrorService.\u0275fac, providedIn: "root" });
1573};
1574(() => {
1575  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(SocialgestShortenerErrorService, [{
1576    type: Injectable,
1577    args: [{ providedIn: "root" }]
1578  }], null, null);
1579})();
1580
1581// libs/socialgest/messenger/src/infrastructure/shortener/socialgest/socialgest-shortener.service.ts
1582var SocialgestShortenerService = class _SocialgestShortenerService {
1583  http = inject(HttpClient);
1584  errorService = inject(SocialgestShortenerErrorService);
1585  create(options) {
1586    return this.http.post(`${environment.urlShort}short_msg`, options).pipe(map((response) => esm_exports.right({
1587      shortUrl: response.data.info.shortlyUrl,
1588      alreadyExist: response.data.info.alreadyExist
1589    })), catchError((error) => of(esm_exports.left(this.errorService.from(error)))));
1590  }
1591  getData(code) {
1592    return this.http.post(`${environment.urlShort}shorts/${code}`, {}).pipe(map((response) => esm_exports.right({ createdAt: response.data.info.created_at })), catchError((error) => of(esm_exports.left(this.errorService.from(error)))));
1593  }
1594  editPreview(input2) {
1595    const body = { created_at: input2.createdAt, image: input2.image, title: input2.title, description: input2.description };
1596    return this.http.put(`${environment.urlShort}short/${input2.createdAt}`, body).pipe(map(() => esm_exports.right(void 0)), catchError((error) => of(esm_exports.left(this.errorService.from(error)))));
1597  }
1598  static \u0275fac = function SocialgestShortenerService_Factory(__ngFactoryType__) {
1599    return new (__ngFactoryType__ || _SocialgestShortenerService)();
1600  };
1601  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _SocialgestShortenerService, factory: _SocialgestShortenerService.\u0275fac, providedIn: "root" });
1602};
1603(() => {
1604  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(SocialgestShortenerService, [{
1605    type: Injectable,
1606    args: [{ providedIn: "root" }]
1607  }], null, null);
1608})();
1609
1610// libs/socialgest/messenger/src/infrastructure/shortener/bitly/bitly-shortener-error.service.ts
1611var MAP_ERRORS4 = {
1612  75: "MESSENGER.SHORTENER.ERRORS.TOKENS",
1613  524: "MESSENGER.SHORTENER.ERRORS.INVALID_URL",
1614  77: "MESSENGER.SHORTENER.ERRORS.NO_ACCOUNT",
1615  429: "MESSENGER.SHORTENER.ERRORS.LIMIT_EXCEEDED",
1616  401: "MESSENGER.SHORTENER.ERRORS.UNEXPECTED"
1617};
1618var BitlyShortenerErrorService = class _BitlyShortenerErrorService {
1619  from(response) {
1620    return new Error(MAP_ERRORS4[response?.error?.meta?.code] ?? "MESSENGER.SHORTENER.ERRORS.UNEXPECTED");
1621  }
1622  static \u0275fac = function BitlyShortenerErrorService_Factory(__ngFactoryType__) {
1623    return new (__ngFactoryType__ || _BitlyShortenerErrorService)();
1624  };
1625  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _BitlyShortenerErrorService, factory: _BitlyShortenerErrorService.\u0275fac, providedIn: "root" });
1626};
1627(() => {
1628  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(BitlyShortenerErrorService, [{
1629    type: Injectable,
1630    args: [{ providedIn: "root" }]
1631  }], null, null);
1632})();
1633
1634// libs/socialgest/messenger/src/infrastructure/shortener/bitly/bitly-shortener.service.ts
1635var BitlyShortenerService = class _BitlyShortenerService {
1636  http = inject(HttpClient);
1637  errorService = inject(BitlyShortenerErrorService);
1638  create(options) {
1639    return this.http.post(`${environment.apiUrlV1}bitly/shorten_v4`, options).pipe(map((response) => esm_exports.right({ shortUrl: response.data.url })), catchError((error) => of(esm_exports.left(this.errorService.from(error)))));
1640  }
1641  static \u0275fac = function BitlyShortenerService_Factory(__ngFactoryType__) {
1642    return new (__ngFactoryType__ || _BitlyShortenerService)();
1643  };
1644  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _BitlyShortenerService, factory: _BitlyShortenerService.\u0275fac, providedIn: "root" });
1645};
1646(() => {
1647  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(BitlyShortenerService, [{
1648    type: Injectable,
1649    args: [{ providedIn: "root" }]
1650  }], null, null);
1651})();
1652
1653// libs/socialgest/messenger/src/infrastructure/shortener/shortener.resolver.ts
1654var ShortenerResolver = class _ShortenerResolver {
1655  socialgest = inject(SocialgestShortenerService);
1656  bitly = inject(BitlyShortenerService);
1657  resolve(type) {
1658    return type === ShortenerType.BITLY ? this.bitly : this.socialgest;
1659  }
1660  static \u0275fac = function ShortenerResolver_Factory(__ngFactoryType__) {
1661    return new (__ngFactoryType__ || _ShortenerResolver)();
1662  };
1663  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _ShortenerResolver, factory: _ShortenerResolver.\u0275fac, providedIn: "root" });
1664};
1665(() => {
1666  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ShortenerResolver, [{
1667    type: Injectable,
1668    args: [{ providedIn: "root" }]
1669  }], null, null);
1670})();
1671
1672// libs/socialgest/messenger/src/infrastructure/shortener/active-textarea.service.ts
1673var ActiveTextareaService = class _ActiveTextareaService {
1674  textarea = null;
1675  set(textarea) {
1676    this.textarea = textarea;
1677  }
1678  get() {
1679    return this.textarea;
1680  }
1681  clear() {
1682    this.textarea = null;
1683  }
1684  static \u0275fac = function ActiveTextareaService_Factory(__ngFactoryType__) {
1685    return new (__ngFactoryType__ || _ActiveTextareaService)();
1686  };
1687  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _ActiveTextareaService, factory: _ActiveTextareaService.\u0275fac, providedIn: "root" });
1688};
1689(() => {
1690  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ActiveTextareaService, [{
1691    type: Injectable,
1692    args: [{ providedIn: "root" }]
1693  }], null, null);
1694})();
1695
1696// libs/socialgest/messenger/src/infrastructure/shortener/url-shortener.handler.ts
1697var UrlShortenerHandler = class _UrlShortenerHandler {
1698  resolver = inject(ShortenerResolver);
1699  config = inject(ShortenerConfigStore);
1700  activeTextarea = inject(ActiveTextareaService);
1701  store = inject(MessengerStore);
1702  userStore = inject(UserStore);
1703  shortening = /* @__PURE__ */ new Set();
1704  debounceTimer = null;
1705  handle(messageValue, textareaService) {
1706    if (this.debounceTimer)
1707      clearTimeout(this.debounceTimer);
1708    this.debounceTimer = setTimeout(() => this.processUrls(messageValue, textareaService), 800);
1709  }
1710  processUrls(text, textareaService) {
1711    const urls = extractShortenableUrls(text).filter((url) => !this.shortening.has(url));
1712    if (urls.length === 0)
1713      return;
1714    const provider = this.resolver.resolve(this.resolveProviderType());
1715    for (const url of urls) {
1716      this.shortening.add(url);
1717      lastValueFrom(provider.create({ url })).then((result) => {
1718        result.mapRight((shortResult) => this.applyReplacement(url, shortResult.shortUrl, textareaService));
1719        result.mapLeft((error) => bus.publish(new RequestFailedEvent(error)));
1720      }).finally(() => this.shortening.delete(url));
1721    }
1722  }
1723  // Auto-shorten falls back to sge.st when the saved provider is Bitly but the
1724  // account is not connected, avoiding a failed request per typed URL.
1725  resolveProviderType() {
1726    const provider = this.config.get().provider;
1727    if (provider === ShortenerType.BITLY && !this.userStore.userList().hasBitly) {
1728      return ShortenerType.SOCIALGEST;
1729    }
1730    return provider;
1731  }
1732  applyReplacement(url, shortUrl, textareaService) {
1733    const post = this.store.post();
1734    const newMessage = post.message.value.split(url).join(shortUrl).trim();
1735    post.set.message(newMessage);
1736    textareaService.set(newMessage);
1737    this.store.refresh();
1738  }
1739  insert(shortUrl) {
1740    const textarea = this.activeTextarea.get();
1741    if (!textarea)
1742      return;
1743    textarea.insertText(shortUrl);
1744    const post = this.store.post();
1745    post.set.message(textarea.value);
1746    this.store.refresh();
1747  }
1748  reset() {
1749    if (this.debounceTimer)
1750      clearTimeout(this.debounceTimer);
1751    this.shortening.clear();
1752  }
1753  static \u0275fac = function UrlShortenerHandler_Factory(__ngFactoryType__) {
1754    return new (__ngFactoryType__ || _UrlShortenerHandler)();
1755  };
1756  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _UrlShortenerHandler, factory: _UrlShortenerHandler.\u0275fac, providedIn: "root" });
1757};
1758(() => {
1759  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(UrlShortenerHandler, [{
1760    type: Injectable,
1761    args: [{ providedIn: "root" }]
1762  }], null, null);
1763})();
1764
1765// libs/socialgest/messenger/src/infrastructure/shortener/url-shortener.subscriber.ts
1766var UrlShortenerSubscriber = class _UrlShortenerSubscriber {
1767  store = inject(MessengerStore);
1768  handler = inject(UrlShortenerHandler);
1769  injector = inject(Injector);
1770  initialized = signal(false);
1771  init(textareaService) {
1772    if (this.initialized())
1773      return;
1774    this.initialized.set(true);
1775    effect(() => {
1776      const autoShorten = this.store.shortener().autoShorten;
1777      const message = this.store.post().message.value;
1778      if (autoShorten && message) {
1779        this.handler.handle(message, textareaService);
1780      }
1781    }, { injector: this.injector });
1782  }
1783  reset() {
1784    this.handler.reset();
1785  }
1786  static \u0275fac = function UrlShortenerSubscriber_Factory(__ngFactoryType__) {
1787    return new (__ngFactoryType__ || _UrlShortenerSubscriber)();
1788  };
1789  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _UrlShortenerSubscriber, factory: _UrlShortenerSubscriber.\u0275fac, providedIn: "root" });
1790};
1791(() => {
1792  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(UrlShortenerSubscriber, [{
1793    type: Injectable,
1794    args: [{ providedIn: "root" }]
1795  }], null, null);
1796})();
1797
1798// libs/socialgest/messenger/src/infrastructure/services/linkedin-pdf.service.ts
1799var LinkedInPdfService = class _LinkedInPdfService {
1800  store = inject(MessengerStore);
1801  canActivate() {
1802    const post = this.store.post();
1803    return post.userList.hasLinkedin && post.multimediaList.has.items && post.multimediaList.has.all.image;
1804  }
1805  convertAndUpload() {
1806    return __async(this, null, function* () {
1807      const items = this.store.post().multimediaList.items.filter((m) => m.isImage());
1808      if (items.length === 0)
1809        return null;
1810      const file = yield this.convertToPdf(items);
1811      const result = yield uploaderService.fromFile(file).complete();
1812      let url = null;
1813      result.mapRight((u) => url = u);
1814      return url;
1815    });
1816  }
1817  convertToPdf(images) {
1818    return __async(this, null, function* () {
1819      let doc = null;
1820      for (const image of images) {
1821        const width = (image.width || 800) * 0.5;
1822        const height = (image.height || 600) * 0.5;
1823        const orientation = width > height ? "l" : "p";
1824        const format = [width, height];
1825        if (!doc) {
1826          doc = new E({ unit: "px", orientation, format });
1827        } else {
1828          doc.addPage(format, orientation);
1829        }
1830        doc.addImage(image.url, "", 0, 0, format[0], format[1]);
1831      }
1832      const blob = doc.output("blob");
1833      return new File([blob], "carousel.pdf", { type: "application/pdf" });
1834    });
1835  }
1836  static \u0275fac = function LinkedInPdfService_Factory(__ngFactoryType__) {
1837    return new (__ngFactoryType__ || _LinkedInPdfService)();
1838  };
1839  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _LinkedInPdfService, factory: _LinkedInPdfService.\u0275fac, providedIn: "root" });
1840};
1841(() => {
1842  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(LinkedInPdfService, [{
1843    type: Injectable,
1844    args: [{ providedIn: "root" }]
1845  }], null, null);
1846})();
1847
1848// libs/socialgest/messenger/src/infrastructure/services/mention-decoder.service.ts
1849var MENTION_REGEX = /@\[(fb|ig|ln):[^\]]+\]/g;
1850var DETAIL_REGEX = /@\[(\w+)(?::([^,]+),)?([^|]+)(?:\|ln:([^|]+))?(?:\|fb:([^|]+))?(?:\|ig:([^|]+))?(?:\|gmb:([^|]+))?\]/;
1851var MentionDecoder = class {
1852  static decode(post) {
1853    const message = post.message.value;
1854    if (!MENTION_REGEX.test(message))
1855      return;
1856    MENTION_REGEX.lastIndex = 0;
1857    const decoded = message.replace(MENTION_REGEX, (match) => {
1858      const details = match.match(DETAIL_REGEX);
1859      if (!details)
1860        return match;
1861      const type = details[1];
1862      const id = details[2] ?? "";
1863      const cleanName = details[3].replace(/[@:]/g, "");
1864      const mention = { id: id || cleanName, name: cleanName, photo: "" };
1865      if (type === "ig")
1866        post.options.instagram.mentionList.insert(mention);
1867      if (type === "fb")
1868        post.options.facebook.mentionList.insert(mention);
1869      if (type === "ln")
1870        post.options.linkedin.mentionList.insert(mention);
1871      return `@${cleanName}`;
1872    });
1873    post.set.message(decoded);
1874  }
1875};
1876
1877// libs/socialgest/messenger/src/infrastructure/services/mention-regex.service.ts
1878var MentionRegexService = class _MentionRegexService {
1879  store = inject(MessengerStore);
1880  getRegex() {
1881    const post = this.store.post();
1882    const allMentions = [
1883      ...post.options.instagram.mentionList.items,
1884      ...post.options.facebook.mentionList.items,
1885      ...post.options.linkedin.mentionList.items
1886    ];
1887    const names = allMentions.map((m) => m.name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).sort((a, b) => b.length - a.length);
1888    if (names.length === 0)
1889      return /(?!)/;
1890    return new RegExp(`@(${names.join("|")})(?![\\w\\d])`, "g");
1891  }
1892  static \u0275fac = function MentionRegexService_Factory(__ngFactoryType__) {
1893    return new (__ngFactoryType__ || _MentionRegexService)();
1894  };
1895  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _MentionRegexService, factory: _MentionRegexService.\u0275fac, providedIn: "root" });
1896};
1897(() => {
1898  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MentionRegexService, [{
1899    type: Injectable,
1900    args: [{ providedIn: "root" }]
1901  }], null, null);
1902})();
1903
1904// libs/socialgest/messenger/src/infrastructure/services/mention-search.service.ts
1905var MentionSearchService = class _MentionSearchService {
1906  http;
1907  constructor(http) {
1908    this.http = http;
1909  }
1910  search(term, userList, userType) {
1911    const filtered = this.getUserForType(userList, userType);
1912    if (!filtered)
1913      return of(esm_exports.right([]));
1914    const cleanTerm = encodeURIComponent(term.replace("@", ""));
1915    const params = `users[0][userid]=${filtered.id}&users[0][name]=${cleanTerm}`;
1916    return this.http.get(`${environment.apiUrlV1}searchusers?${params}`).pipe(map((response) => esm_exports.right(this.mapResponse(response, userType))), catchError((err) => of(esm_exports.left(err))));
1917  }
1918  mapResponse(response, userType) {
1919    switch (userType) {
1920      case UserType.INSTAGRAM:
1921        return this.mapInstagram(response);
1922      case UserType.FACEBOOK:
1923        return this.mapFacebook(response);
1924      case UserType.LINKEDIN:
1925        return this.mapLinkedin(response);
1926      default:
1927        return [];
1928    }
1929  }
1930  mapInstagram(response) {
1931    const user = response?.["3"]?.users;
1932    if (!user?.id)
1933      return [];
1934    return [{ id: user.id, name: user.username, photo: user.profile_picture_url ?? "" }];
1935  }
1936  mapFacebook(response) {
1937    const data = response?.["2"];
1938    if (!data)
1939      return [];
1940    const users = Array.isArray(data) ? data : data.users ? [data.users].flat() : [data];
1941    return users.filter((u) => u?.id).map((u) => ({ id: u.id, name: u.name, photo: u.picture?.data?.url ?? "" }));
1942  }
1943  mapLinkedin(response) {
1944    const items = response?.["4"]?.data?.info;
1945    if (!Array.isArray(items))
1946      return [];
1947    return items.map((u) => ({ id: u.id, name: u.localizedName, photo: u.logoV2 ?? "" }));
1948  }
1949  getUserForType(userList, userType) {
1950    switch (userType) {
1951      case UserType.INSTAGRAM:
1952        return userList.instagram.first;
1953      case UserType.FACEBOOK:
1954        return userList.facebook.first;
1955      case UserType.LINKEDIN:
1956        return userList.linkedin.first;
1957      default:
1958        return null;
1959    }
1960  }
1961  static \u0275fac = function MentionSearchService_Factory(__ngFactoryType__) {
1962    return new (__ngFactoryType__ || _MentionSearchService)(\u0275\u0275inject(HttpClient));
1963  };
1964  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _MentionSearchService, factory: _MentionSearchService.\u0275fac, providedIn: "root" });
1965};
1966(() => {
1967  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MentionSearchService, [{
1968    type: Injectable,
1969    args: [{ providedIn: "root" }]
1970  }], () => [{ type: HttpClient }], null);
1971})();
1972
1973// libs/socialgest/messenger/src/infrastructure/services/pinterest-boards.service.ts
1974var PinterestBoardsService = class _PinterestBoardsService {
1975  http = inject(HttpClient);
1976  apiUrl = `${environment.apiUrlV1}`;
1977  list(userId) {
1978    return this.http.get(`${this.apiUrl}pinterest/${userId}/sections`).pipe(map((response) => response?.data?.info?.items || []), catchError(() => of([])));
1979  }
1980  create(userId, name) {
1981    return this.http.post(`${this.apiUrl}pinterest/${userId}/sections`, { name }).pipe(map(() => true), catchError(() => of(false)));
1982  }
1983  static \u0275fac = function PinterestBoardsService_Factory(__ngFactoryType__) {
1984    return new (__ngFactoryType__ || _PinterestBoardsService)();
1985  };
1986  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _PinterestBoardsService, factory: _PinterestBoardsService.\u0275fac, providedIn: "root" });
1987};
1988(() => {
1989  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PinterestBoardsService, [{
1990    type: Injectable,
1991    args: [{ providedIn: "root" }]
1992  }], null, null);
1993})();
1994
1995// libs/socialgest/messenger/src/infrastructure/services/youtube-categories.service.ts
1996var YouTubeCategoriesService = class _YouTubeCategoriesService {
1997  http = inject(HttpClient);
1998  apiUrl = `${environment.apiUrlV1}`;
1999  list(userId) {
2000    return this.http.get(`${this.apiUrl}youtube/${userId}/categories`).pipe(map((response) => (response?.data?.content?.items || []).filter((item) => item.snippet.assignable)), catchError(() => of([])));
2001  }
2002  static \u0275fac = function YouTubeCategoriesService_Factory(__ngFactoryType__) {
2003    return new (__ngFactoryType__ || _YouTubeCategoriesService)();
2004  };
2005  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _YouTubeCategoriesService, factory: _YouTubeCategoriesService.\u0275fac, providedIn: "root" });
2006};
2007(() => {
2008  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(YouTubeCategoriesService, [{
2009    type: Injectable,
2010    args: [{ providedIn: "root" }]
2011  }], null, null);
2012})();
2013
2014// libs/socialgest/messenger/src/presenter/components/group-selector/group-selector.component.ts
2015var _c02 = ["popover"];
2016function GroupSelectorComponent_ng_template_9_Conditional_0_Template(rf, ctx) {
2017  if (rf & 1) {
2018    const _r2 = \u0275\u0275getCurrentView();
2019    \u0275\u0275elementStart(0, "ui-group-list", 10);
2020    \u0275\u0275listener("valueChange", function GroupSelectorComponent_ng_template_9_Conditional_0_Template_ui_group_list_valueChange_0_listener() {
2021      \u0275\u0275restoreView(_r2);
2022      const ctx_r2 = \u0275\u0275nextContext(2);
2023      return \u0275\u0275resetView(ctx_r2.select());
2024    })("view", function GroupSelectorComponent_ng_template_9_Conditional_0_Template_ui_group_list_view_0_listener($event) {
2025      \u0275\u0275restoreView(_r2);
2026      const ctx_r2 = \u0275\u0275nextContext(2);
2027      return \u0275\u0275resetView(ctx_r2.openDetails($event));
2028    })("edit", function GroupSelectorComponent_ng_template_9_Conditional_0_Template_ui_group_list_edit_0_listener($event) {
2029      \u0275\u0275restoreView(_r2);
2030      const ctx_r2 = \u0275\u0275nextContext(2);
2031      return \u0275\u0275resetView(ctx_r2.openEdit($event));
2032    })("remove", function GroupSelectorComponent_ng_template_9_Conditional_0_Template_ui_group_list_remove_0_listener($event) {
2033      \u0275\u0275restoreView(_r2);
2034      const ctx_r2 = \u0275\u0275nextContext(2);
2035      return \u0275\u0275resetView(ctx_r2.confirmRemove($event));
2036    });
2037    \u0275\u0275elementEnd();
2038  }
2039  if (rf & 2) {
2040    const groupList_r4 = \u0275\u0275nextContext().$implicit;
2041    \u0275\u0275property("groupList", groupList_r4);
2042  }
2043}
2044function GroupSelectorComponent_ng_template_9_Conditional_1_Template(rf, ctx) {
2045  if (rf & 1) {
2046    \u0275\u0275elementStart(0, "p", 9);
2047    \u0275\u0275text(1);
2048    \u0275\u0275pipe(2, "translate");
2049    \u0275\u0275elementEnd();
2050  }
2051  if (rf & 2) {
2052    \u0275\u0275advance();
2053    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(2, 1, "MESSENGER.GROUPS.EMPTY"));
2054  }
2055}
2056function GroupSelectorComponent_ng_template_9_Template(rf, ctx) {
2057  if (rf & 1) {
2058    \u0275\u0275conditionalCreate(0, GroupSelectorComponent_ng_template_9_Conditional_0_Template, 1, 1, "ui-group-list", 8)(1, GroupSelectorComponent_ng_template_9_Conditional_1_Template, 3, 3, "p", 9);
2059  }
2060  if (rf & 2) {
2061    const groupList_r4 = ctx.$implicit;
2062    \u0275\u0275conditional(groupList_r4.has.items ? 0 : 1);
2063  }
2064}
2065var GroupSelectorComponent = class _GroupSelectorComponent {
2066  store = inject(MessengerStore);
2067  userStore = inject(UserStore);
2068  groupStore = inject(GroupStore);
2069  popover = viewChild.required("popover");
2070  dialogService = inject(DialogService);
2071  confirmDialog = inject(ConfirmDialogService);
2072  groupService = inject(GroupService);
2073  toast = inject(SonnerToasterService);
2074  transloco = inject(TranslocoService);
2075  /** Ids of groups currently applied to the post — used to diff additions/removals. */
2076  selectedGroupIds = signal([]);
2077  constructor() {
2078    inject(GroupSubscriber).init();
2079  }
2080  /** Opens/closes the groups popover, anchored to the provided trigger event. */
2081  toggle(event) {
2082    this.popover().toggle(event);
2083  }
2084  /**
2085   * Clears the per-session selection so the popover always opens in its initial (deselected) state.
2086   * Group selection lives on the shared store entities, so without this it would persist across opens.
2087   * Already-applied members stay in the post — only the visual selection resets.
2088   */
2089  resetSelection() {
2090    this.groupStore.groupList().unselect.all();
2091    this.selectedGroupIds.set([]);
2092  }
2093  hide() {
2094    this.popover().hide();
2095  }
2096  isOpen() {
2097    return this.popover().isOpen();
2098  }
2099  /**
2100   * Adds/removes a group's users from the post (additive multi-select, mirrors legacy).
2101   * Selection lives on the shared Group entities, so we read it from the full store list
2102   * rather than the event payload (which only carries the search-filtered selection).
2103   */
2104  select() {
2105    const selectedGroups = this.groupStore.groupList().items.filter((group) => group.selected);
2106    const currentIds = selectedGroups.map((group) => group.getId());
2107    const previousIds = this.selectedGroupIds();
2108    const added = selectedGroups.filter((group) => !previousIds.includes(group.getId()));
2109    const removedIds = previousIds.filter((id) => !currentIds.includes(id));
2110    let userList = this.store.post().userList;
2111    added.forEach((group) => {
2112      const members = this.enrich(group);
2113      members.select.all();
2114      userList = userList.immutable.merge(members);
2115    });
2116    if (removedIds.length) {
2117      const keepIds = /* @__PURE__ */ new Set();
2118      currentIds.forEach((id) => this.groupStore.groupList().find(id)?.userIds.forEach((uid) => keepIds.add(uid)));
2119      const dropIds = /* @__PURE__ */ new Set();
2120      removedIds.forEach((id) => this.groupStore.groupList().find(id)?.userIds.forEach((uid) => !keepIds.has(uid) && dropIds.add(uid)));
2121      userList = UserList.from(userList.users.filter((user) => !dropIds.has(user.id)));
2122    }
2123    this.store.post().set.userList(userList);
2124    sleep(100).then(() => this.store.refresh());
2125    this.selectedGroupIds.set(currentIds);
2126  }
2127  openCreate() {
2128    this.popover().hide();
2129    const ref = this.dialogService.open(SaveGroupComponent, dialogConfig({
2130      data: { group: null },
2131      header: this.transloco.translate("MESSENGER.GROUPS.CREATE"),
2132      style: { width: "42rem" }
2133    }));
2134    ref.onClose.subscribe((result) => result && this.create(result));
2135  }
2136  openEdit(group) {
2137    this.popover().hide();
2138    const ref = this.dialogService.open(SaveGroupComponent, dialogConfig({
2139      data: { group },
2140      header: this.transloco.translate("MESSENGER.GROUPS.EDIT"),
2141      style: { width: "42rem" }
2142    }));
2143    ref.onClose.subscribe((result) => result && this.update(group, result));
2144  }
2145  openDetails(group) {
2146    this.dialogService.open(GroupDetailsComponent, dialogConfig({
2147      data: { group },
2148      header: this.transloco.translate("MESSENGER.GROUPS.MEMBERS"),
2149      style: { width: "32rem" }
2150    }));
2151  }
2152  confirmRemove(group) {
2153    this.confirmDialog.warning({
2154      headerLabel: "MESSENGER.GROUPS.DELETE_CONFIRM_TITLE",
2155      contentLabel: "MESSENGER.GROUPS.DELETE_CONFIRM_DESCRIPTION",
2156      acceptLabel: "GLOBAL.REMOVE",
2157      rejectLabel: "GLOBAL.CANCEL"
2158    }).subscribe((result) => result.mapRight(() => this.remove(group)));
2159  }
2160  create(result) {
2161    return __async(this, null, function* () {
2162      this.toast.wait("GLOBAL.PROGRESS.VALIDATING");
2163      const created = yield firstValueFrom(this.groupService.create$(result.name, result.color));
2164      if (created.isLeft()) {
2165        this.toast.dismissWait();
2166        this.toast.error(new Exception(created.value.message));
2167        return;
2168      }
2169      const groupId = created.unwrap();
2170      if (result.accountUserIds.length)
2171        yield firstValueFrom(this.groupService.addUsers$(groupId, result.accountUserIds));
2172      this.toast.dismissWait();
2173      this.toast.success("MESSENGER.GROUPS.CREATED");
2174      this.groupStore.update();
2175    });
2176  }
2177  update(group, result) {
2178    return __async(this, null, function* () {
2179      const previous = group.accountUserIds;
2180      const next = result.accountUserIds;
2181      const deleted = previous.filter((id) => !next.includes(id));
2182      const added = next.filter((id) => !previous.includes(id));
2183      this.toast.wait("GLOBAL.PROGRESS.VALIDATING");
2184      const updated = yield firstValueFrom(this.groupService.update$(group.getId(), result.name, result.color, deleted, added));
2185      this.toast.dismissWait();
2186      updated.mapRight(() => {
2187        this.toast.success("MESSENGER.GROUPS.UPDATED");
2188        this.groupStore.update();
2189      });
2190      updated.mapLeft((error) => this.toast.error(new Exception(error.message)));
2191    });
2192  }
2193  remove(group) {
2194    return __async(this, null, function* () {
2195      const deleted = yield firstValueFrom(this.groupService.delete$(group.getId()));
2196      deleted.mapRight(() => {
2197        this.removeGroupUsersFromPost(group);
2198        this.groupStore.remove(group);
2199        this.selectedGroupIds.set(this.selectedGroupIds().filter((id) => id !== group.getId()));
2200        this.toast.success("MESSENGER.GROUPS.DELETED");
2201      });
2202      deleted.mapLeft((error) => this.toast.error(new Exception(error.message)));
2203    });
2204  }
2205  /** Resolves the group's members against the loaded user list to get full User entities. */
2206  enrich(group) {
2207    const available = this.userStore.userList();
2208    const users = group.userList.users.map((member) => available.users.find((u) => u.id === member.id) ?? member);
2209    return UserList.from(users).ok.publishers.copy();
2210  }
2211  removeGroupUsersFromPost(group) {
2212    const dropIds = new Set(group.userIds);
2213    const userList = UserList.from(this.store.post().userList.users.filter((user) => !dropIds.has(user.id)));
2214    this.store.post().set.userList(userList);
2215    this.store.refresh();
2216  }
2217  static \u0275fac = function GroupSelectorComponent_Factory(__ngFactoryType__) {
2218    return new (__ngFactoryType__ || _GroupSelectorComponent)();
2219  };
2220  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _GroupSelectorComponent, selectors: [["app-group-selector"]], viewQuery: function GroupSelectorComponent_Query(rf, ctx) {
2221    if (rf & 1) {
2222      \u0275\u0275viewQuerySignal(ctx.popover, _c02, 5);
2223    }
2224    if (rf & 2) {
2225      \u0275\u0275queryAdvance();
2226    }
2227  }, decls: 11, vars: 6, consts: [["popover", ""], ["groupListTemplate", ""], ["styleClass", "group-popover w-[24rem] h-[24rem] p-0! py-2!", 3, "open"], [1, "h-full", "grid", "grid-rows-[auto_1fr]", "gap-2", "px-4", "py-2"], [1, "flex", "items-center", "justify-between", "ga
2227p-2"], [1, "text-lg", "font-semibold"], ["icon", "plus", "label", "MESSENGER.GROUPS.CREATE", "severity", "contrast", "size", "small", "styleClass", "mb-2 text-md!", 3, "click", "fluid"], [1, "block", "relative", "h-full", 3, "groupList", "size"], [3, "groupList"], [1, "text-sm", "text-grey-300", "text-center", "pt-8"], [3, "valueChange", "view", "edit", "remove", "groupList"]], template: function GroupSelectorComponent_Template(rf, ctx) {
2228    if (rf & 1) {
2229      const _r1 = \u0275\u0275getCurrentView();
2230      \u0275\u0275elementStart(0, "ui-popover", 2, 0);
2231      \u0275\u0275listener("open", function GroupSelectorComponent_Template_ui_popover_open_0_listener() {
2232        \u0275\u0275restoreView(_r1);
2233        return \u0275\u0275resetView(ctx.resetSelection());
2234      });
2235      \u0275\u0275elementStart(2, "div", 3)(3, "header", 4)(4, "h3", 5);
2236      \u0275\u0275text(5);
2237      \u0275\u0275pipe(6, "translate");
2238      \u0275\u0275elementEnd();
2239      \u0275\u0275elementStart(7, "ui-button", 6);
2240      \u0275\u0275listener("click", function GroupSelectorComponent_Template_ui_button_click_7_listener() {
2241        \u0275\u0275restoreView(_r1);
2242        return \u0275\u0275resetView(ctx.openCreate());
2243      });
2244      \u0275\u0275elementEnd()();
2245      \u0275\u0275elementStart(8, "ui-group-list-search", 7);
2246      \u0275\u0275template(9, GroupSelectorComponent_ng_template_9_Template, 2, 1, "ng-template", null, 1, \u0275\u0275templateRefExtractor);
2247      \u0275\u0275elementEnd()()();
2248    }
2249    if (rf & 2) {
2250      \u0275\u0275advance(5);
2251      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(6, 4, "MESSENGER.GROUPS.TITLE"));
2252      \u0275\u0275advance(2);
2253      \u0275\u0275property("fluid", false);
2254      \u0275\u0275advance();
2255      \u0275\u0275property("groupList", ctx.groupStore.groupList())("size", "small");
2256    }
2257  }, dependencies: [
2258    CommonModule,
2259    TranslatePipe,
2260    ButtonComponent,
2261    PopoverComponent,
2262    GroupListComponent,
2263    GroupListSearchComponent
2264  ], encapsulation: 2 });
2265};
2266(() => {
2267  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(GroupSelectorComponent, [{
2268    type: Component,
2269    args: [{ selector: "app-group-selector", imports: [
2270      CommonModule,
2271      TranslatePipe,
2272      ButtonComponent,
2273      PopoverComponent,
2274      GroupListComponent,
2275      GroupListSearchComponent
2276    ], template: `<ui-popover #popover (open)="resetSelection()" styleClass="group-popover w-[24rem] h-[24rem] p-0! py-2!">
2277  <div class="h-full grid grid-rows-[auto_1fr] gap-2 px-4 py-2">
2278    <header class="flex items-center justify-between gap-2">
2279      <h3 class="text-lg font-semibold">{{ 'MESSENGER.GROUPS.TITLE' | translate }}</h3>
2280      <ui-button
2281        (click)="openCreate()"
2282        icon="plus"
2283        label="MESSENGER.GROUPS.CREATE"
2284        severity="contrast"
2285        size="small"
2286        [fluid]="false"
2287        styleClass="mb-2 text-md!"
2288      />
2289    </header>
2290
2291    <ui-group-list-search [groupList]="groupStore.groupList()" [size]="'small'" class="block relative h-full">
2292      <ng-template #groupListTemplate let-groupList>
2293        @if (groupList.has.items) {
2294        <ui-group-list
2295          [groupList]="groupList"
2296          (valueChange)="select()"
2297          (view)="openDetails($event)"
2298          (edit)="openEdit($event)"
2299          (remove)="confirmRemove($event)"
2300        />
2301        } @else {
2302        <p class="text-sm text-grey-300 text-center pt-8">{{ 'MESSENGER.GROUPS.EMPTY' | translate }}</p>
2303        }
2304      </ng-template>
2305    </ui-group-list-search>
2306  </div>
2307</ui-popover>
2308` }]
2309  }], () => [], null);
2310})();
2311(() => {
2312  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(GroupSelectorComponent, { className: "GroupSelectorComponent", filePath: "libs/socialgest/messenger/src/presenter/components/group-selector/group-selector.component.ts", lineNumber: 23 });
2313})();
2314
2315// libs/socialgest/messenger/src/presenter/components/user-list/user-list.component.ts
2316function UserListComponent_Conditional_9_Template(rf, ctx) {
2317  if (rf & 1) {
2318    const _r2 = \u0275\u0275getCurrentView();
2319    \u0275\u0275elementStart(0, "div", 10)(1, "button", 12);
2320    \u0275\u0275pipe(2, "translate");
2321    \u0275\u0275listener("click", function UserListComponent_Conditional_9_Template_button_click_1_listener($event) {
2322      \u0275\u0275restoreView(_r2);
2323      \u0275\u0275nextContext();
2324      const gs_r3 = \u0275\u0275reference(11);
2325      const menu_r4 = \u0275\u0275reference(13);
2326      gs_r3.hide();
2327      return \u0275\u0275resetView(menu_r4.toggle($event));
2328    });
2329    \u0275\u0275element(3, "ui-icon", 13);
2330    \u0275\u0275elementStart(4, "span", 14);
2331    \u0275\u0275text(5);
2332    \u0275\u0275pipe(6, "translate");
2333    \u0275\u0275elementEnd()();
2334    \u0275\u0275elementStart(7, "button", 15);
2335    \u0275\u0275pipe(8, "translate");
2336    \u0275\u0275listener("click", function UserListComponent_Conditional_9_Template_button_click_7_listener($event) {
2337      \u0275\u0275restoreView(_r2);
2338      \u0275\u0275nextContext();
2339      const gs_r3 = \u0275\u0275reference(11);
2340      const menu_r4 = \u0275\u0275reference(13);
2341      menu_r4.hide();
2342      return \u0275\u0275resetView(gs_r3.toggle($event));
2343    });
2344    \u0275\u0275element(9, "ui-icon", 16);
2345    \u0275\u0275elementEnd()();
2346  }
2347  if (rf & 2) {
2348    const ctx_r4 = \u0275\u0275nextContext();
2349    \u0275\u0275advance();
2350    \u0275\u0275property("tooltip", ctx_r4.channelCtaExpanded() ? "" : \u0275\u0275pipeBind1(2, 5, "CHANNELS.ADD_CHANNELS"));
2351    \u0275\u0275advance(3);
2352    \u0275\u0275classMap(ctx_r4.channelCtaExpanded() ? "max-w-[14rem] ps-2 pe-1 opacity-100" : "max-w-0 px-0 opacity-0");
2353    \u0275\u0275advance();
2354    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(6, 7, "CHANNELS.SELECT_CHANNEL"), " ");
2355    \u0275\u0275advance(2);
2356    \u0275\u0275property("tooltip", \u0275\u0275pipeBind1(8, 9, "MESSENGER.GROUPS.TITLE"));
2357  }
2358}
2359function UserListComponent_ng_template_14_ng_template_2_Conditional_1_Template(rf, ctx) {
2360  if (rf & 1) {
2361    \u0275\u0275element(0, "ui-empty-list", 19);
2362  }
2363  if (rf & 2) {
2364    \u0275\u0275property("hasItems", true)("noResultsLabel", "GLOBAL.EMPTY.NO_RESULTS_CHANNEL_TITLE")("noResultsDescription", "GLOBAL.EMPTY.NO_RESULTS_CHANNEL_DESC")("isScreenView", false);
2365  }
2366}
2367function UserListComponent_ng_template_14_ng_template_2_Template(rf, ctx) {
2368  if (rf & 1) {
2369    const _r6 = \u0275\u0275getCurrentView();
2370    \u0275\u0275elementStart(0, "ui-user-list", 18);
2371    \u0275\u0275listener("valueChange", function UserListComponent_ng_template_14_ng_template_2_Template_ui_user_list_valueChange_0_listener($event) {
2372      \u0275\u0275restoreView(_r6);
2373      const ctx_r4 = \u0275\u0275nextContext(2);
2374      return \u0275\u0275resetView(ctx_r4.onChange($event));
2375    });
2376    \u0275\u0275elementEnd();
2377    \u0275\u0275conditionalCreate(1, UserListComponent_ng_template_14_ng_template_2_Conditional_1_Template, 1, 4, "ui-empty-list", 19);
2378  }
2379  if (rf & 2) {
2380    const userList_r7 = ctx.$implicit;
2381    \u0275\u0275property("userList", userList_r7.ok.publishers)("avatarSize", "large")("showTooltip", true);
2382    \u0275\u0275advance();
2383    \u0275\u0275conditional(userList_r7.ok.publishers.visibles.isEmpty ? 1 : -1);
2384  }
2385}
2386function UserListComponent_ng_template_14_Template(rf, ctx) {
2387  if (rf & 1) {
2388    \u0275\u0275elementStart(0, "ui-user-search", 17, 3);
2389    \u0275\u0275template(2, UserListComponent_ng_template_14_ng_template_2_Template, 2, 4, "ng-template", null, 4, \u0275\u0275templateRefExtractor);
2390    \u0275\u0275elementEnd();
2391  }
2392  if (rf & 2) {
2393    const ctx_r4 = \u0275\u0275nextContext();
2394    \u0275\u0275property("userList", ctx_r4.userList())("showCounter", false)("size", "small");
2395  }
2396}
2397var UserListComponent2 = class _UserListComponent {
2398  store = inject(MessengerStore);
2399  userStore = inject(UserStore);
2400  topPublishersApplied = false;
2401  pickerOpen = signal(false);
2402  channelCtaExpanded = computed(() => !this.pickerOpen() && !this.store.post().userList.has.items);
2403  userList = linkedSignal(() => {
2404    const userList = this.userStore.userList().copy();
2405    userList.unselect.all();
2406    return userList.immutable.merge(this.store.post().userList);
2407  });
2408  constructor() {
2409    effect(() => {
2410      const post = this.store.post();
2411      const topIds = this.userStore.topPublisherIds();
2412      const availableUsers = this.userStore.userList();
2413      if (!post.is.new || this.topPublishersApplied || post.userList.has.items || topIds.length === 0 || availableUsers.isEmpty)
2414        return;
2415      untracked(() => {
2416        this.topPublishersApplied = true;
2417        const users = availableUsers.users.filter((u) => topIds.includes(u.id));
2418        if (users.length === 0)
2419          return;
2420        const selected = UserList.from(users);
2421        selected.select.all();
2422        this.store.post().set.userList(selected);
2423        this.store.refresh();
2424      });
2425    });
2426  }
2427  onChange(selected) {
2428    this.store.post().set.userList(selected);
2429    this.syncThreadState(selected);
2430    sleep(300).then(() => this.store.refresh());
2431  }
2432  onRemove(user) {
2433    this.store.post().userList.mutable.remove(user);
2434    this.syncThreadState(this.store.post().userList);
2435    sleep(300).then(() => this.store.refresh());
2436  }
2437  syncThreadState(userList) {
2438    if (this.store.thread().x.active && !userList.hasX)
2439      this.store.disableThread(UserType.X);
2440    if (this.store.thread().threads.active && !userList.hasThreads)
2441      this.store.disableThread(UserType.THREADS);
2442  }
2443  static \u0275fac = function UserListComponent_Factory(__ngFactoryType__) {
2444    return new (__ngFactoryType__ || _UserListComponent)();
2445  };
2446  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _UserListComponent, selectors: [["app-user-list"]], decls: 16, vars: 13, consts: [["gs", ""], ["menu", ""], ["item", ""], ["ref", ""], ["userListTemplate", ""], [1, "h-[5.25rem]", "flex", "items-center", "justify-between", "border-b", "border-grey-50"], [1, "text-lg", "font-semibold"], [1, "text-grey-100", "mr-2"], [1, "flex", "items-center", "gap-4"], ["styleClass", "gap-4!", 3, "remove", "userList", "count", "showRemove", "cardMode"], [1, "flex", "items-center", "ml-1", "gap-3"], ["styleClass", "w-[34rem] h-[22rem] top-21! left-32! menu--custom", 3, "open", "closed", "autoClose", "appendTo"], ["type", "button", "tooltipPosition", "top", 1, "h-9", "px-2", "flex", "items-center", "text-white", "bg-secondary-500", "hover:bg-secondary-600", "justify-center", "cursor-pointer", "transition-colors", "border", "border-secondary-500", "hover:border-secondary-600", "rounded-base", "focu
2446s:outline-none", "focus-visible:ring-2", "focus-visible:ring-secondary-500", "focus-visible:ring-offset-2", 3, "click", "tooltip"], ["name", "plus", "styleClass", "size-5", 1, "shrink-0"], [1, "overflow-hidden", "whitespace-nowrap", "text-sm", "font-semibold", "transition-all", "duration-300", "ease-out"], ["type", "button", "tooltipPosition", "top", 1, "size-9", "flex", "text-grey-500", "hover:bg-grey-50", "items-center", "justify-center", "cursor-pointer", "transition-colors", "border", "border-grey-100", "rounded-base", 3, "click", "tooltip"], ["name", "group", "styleClass", "size-5"], ["headerStyleClass", "px-2 pt-2 mb-4", "styleClass", "gap-0!", 1, "absolute", "inset-4", 3, "userList", "showCounter", "size"], ["segmentStyleClass", "rounded-base!", "nameStyleClass", "text-sm!", "styleClass", "grid grid-cols-2 gap-x-1! gap-y-4! content-start pt-2 pb-4", 1, "segment-thin", 2, "--p-card-body-padding", "0.65rem 1rem", 3, "valueChange", "userList", "avatarSize", "showTooltip"], ["emptyStyleClass", "gap-2!", "iconStyleClass", "size-24!", 1, "absolute", "inset-0", 3, "hasItems", "noResultsLabel", "noResultsDescription", "isScreenView"]], template: function UserListComponent_Template(rf, ctx) {
2447    if (rf & 1) {
2448      const _r1 = \u0275\u0275getCurrentView();
2449      \u0275\u0275elementStart(0, "header", 5)(1, "h2", 6)(2, "span", 7);
2450      \u0275\u0275text(3);
2451      \u0275\u0275pipe(4, "translate");
2452      \u0275\u0275elementEnd();
2453      \u0275\u0275text(5);
2454      \u0275\u0275pipe(6, "translate");
2455      \u0275\u0275elementEnd();
2456      \u0275\u0275elementStart(7, "div", 8)(8, "ui-user-avatar-list", 9);
2457      \u0275\u0275listener("remove", function UserListComponent_Template_ui_user_avatar_list_remove_8_listener($event) {
2458        \u0275\u0275restoreView(_r1);
2459        return \u0275\u0275resetView(ctx.onRemove($event));
2460      });
2461      \u0275\u0275elementEnd();
2462      \u0275\u0275conditionalCreate(9, UserListComponent_Conditional_9_Template, 10, 11, "div", 10);
2463      \u0275\u0275elementEnd()();
2464      \u0275\u0275element(10, "app-group-selector", null, 0);
2465      \u0275\u0275elementStart(12, "ui-menu", 11, 1);
2466      \u0275\u0275listener("open", function UserListComponent_Template_ui_menu_open_12_listener() {
2467        \u0275\u0275restoreView(_r1);
2468        return \u0275\u0275resetView(ctx.pickerOpen.set(true));
2469      })("closed", function UserListComponent_Template_ui_menu_closed_12_listener() {
2470        \u0275\u0275restoreView(_r1);
2471        return \u0275\u0275resetView(ctx.pickerOpen.set(false));
2472      });
2473      \u0275\u0275template(14, UserListComponent_ng_template_14_Template, 4, 3, "ng-template", null, 2, \u0275\u0275templateRefExtractor);
2474      \u0275\u0275elementEnd();
2475    }
2476    if (rf & 2) {
2477      \u0275\u0275advance(3);
2478      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 9, "GLOBAL.1"));
2479      \u0275\u0275advance(2);
2480      \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(6, 11, "BATCH_LOADER.SELECT_CHANNELS"), " ");
2481      \u0275\u0275advance(3);
2482      \u0275\u0275property("userList", ctx.store.post().userList)("count", 4)("showRemove", !ctx.store.post().has.cyclic)("cardMode", true);
2483      \u0275\u0275advance();
2484      \u0275\u0275conditional(!ctx.store.isCyclicList() ? 9 : -1);
2485      \u0275\u0275advance(3);
2486      \u0275\u0275property("autoClose", false)("appendTo", void 0);
2487    }
2488  }, dependencies: [
2489    CommonModule,
2490    TranslatePipe,
2491    UserAvatarListComponent,
2492    IconComponent,
2493    TooltipDirective,
2494    MenuComponent,
2495    UserSearchComponent,
2496    UserListComponent,
2497    EmptyListComponent,
2498    GroupSelectorComponent
2499  ], styles: ["\n\n[_nghost-%COMP%] {\n  position: relative;\n}"] });
2500};
2501(() => {
2502  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(UserListComponent2, [{
2503    type: Component,
2504    args: [{ selector: "app-user-list", imports: [
2505      CommonModule,
2506      TranslatePipe,
2507      UserAvatarListComponent,
2508      ButtonComponent,
2509      IconComponent,
2510      TooltipDirective,
2511      MenuComponent,
2512      UserSearchComponent,
2513      UserListComponent,
2514      EmptyListComponent,
2515      GroupSelectorComponent
2516    ], template: `<header class="h-[5.25rem] flex items-center justify-between border-b border-grey-50">
2517  <h2 class="text-lg font-semibold">
2518    <span class="text-grey-100 mr-2">{{ 'GLOBAL.1' | translate }}</span>
2519    {{ 'BATCH_LOADER.SELECT_CHANNELS' | translate }}
2520  </h2>
2521  <div class="flex items-center gap-4">
2522    <ui-user-avatar-list
2523      (remove)="onRemove($event)"
2524      [userList]="store.post().userList"
2525      [count]="4"
2526      [showRemove]="!store.post().has.cyclic"
2527      [cardMode]="true"
2528      styleClass="gap-4!"
2529    />
2530    @if (!store.isCyclicList()) {
2531    <div class="flex items-center ml-1 gap-3">
2532      <button
2533        type="button"
2534        [tooltip]="channelCtaExpanded() ? '' : ('CHANNELS.ADD_CHANNELS' | translate)"
2535        tooltipPosition="top"
2536        (click)="gs.hide(); menu.toggle($event)"
2537        class="h-9 px-2 flex items-center text-white bg-secondary-500 hover:bg-secondary-600 justify-center cursor-pointer transition-colors border border-secondary-500 hover:border-secondary-600 rounded-base focus:outline-none focus-visible:ring-2 focus-visible:ring-secondary-500 focus-visible:ring-offset-2"
2538      >
2539        <ui-icon name="plus" styleClass="size-5" class="shrink-0" />
2540        <span
2541          class="overflow-hidden whitespace-nowrap text-sm font-semibold transition-all duration-300 ease-out"
2542          [class]="channelCtaExpanded() ? 'max-w-[14rem] ps-2 pe-1 opacity-100' : 'max-w-0 px-0 opacity-0'"
2543        >
2544          {{ 'CHANNELS.SELECT_CHANNEL' | translate }}
2545        </span>
2546      </button>
2547      <button
2548        type="button"
2549        [tooltip]="'MESSENGER.GROUPS.TITLE' | translate"
2550        tooltipPosition="top"
2551        (click)="menu.hide(); gs.toggle($event)"
2552        class="size-9 flex text-grey-500 hover:bg-grey-50 items-center justify-center cursor-pointer transition-colors border border-grey-100 rounded-base"
2553      >
2554        <ui-icon name="group" styleClass="size-5" />
2555      </button>
2556    </div>
2557
2558    }
2559  </div>
2560</header>
2561
2562<app-group-selector #gs />
2563
2564<ui-menu
2565  #menu
2566  (open)="pickerOpen.set(true)"
2567  (closed)="pickerOpen.set(false)"
2568  [autoClose]="false"
2569  [appendTo]="undefined"
2570  styleClass="w-[34rem] h-[22rem] top-21! left-32! menu--custom"
2571>
2572  <ng-template #item>
2573    <ui-user-search
2574      #ref
2575      [userList]="userList()"
2576      [showCounter]="false"
2577      [size]="'small'"
2578      headerStyleClass="px-2 pt-2 mb-4"
2579      styleClass="gap-0!"
2580      class="absolute inset-4"
2581    >
2582      <ng-template #userListTemplate let-userList>
2583        <ui-user-list
2584          (valueChange)="onChange($event)"
2585          [userList]="userList.ok.publishers"
2586          [avatarSize]="'large'"
2587          [showTooltip]="true"
2588          segmentStyleClass="rounded-base!"
2589          nameStyleClass="text-sm!"
2590          styleClass="grid grid-cols-2 gap-x-1! gap-y-4! content-start pt-2 pb-4"
2591          style="--p-card-body-padding: 0.65rem 1rem"
2592          class="segment-thin"
2593        />
2594
2595        @if(userList.ok.publishers.visibles.isEmpty){
2596        <ui-empty-list
2597          [hasItems]="true"
2598          [noResultsLabel]="'GLOBAL.EMPTY.NO_RESULTS_CHANNEL_TITLE'"
2599          [noResultsDescription]="'GLOBAL.EMPTY.NO_RESULTS_CHANNEL_DESC'"
2600          [isScreenView]="false"
2601          emptyStyleClass="gap-2!"
2602          iconStyleClass="size-24!"
2603          class="absolute inset-0"
2604        />
2605        }
2606      </ng-template>
2607    </ui-user-search>
2608  </ng-template>
2609</ui-menu>
2610`, styles: ["/* angular:styles/component:css;b91b755ef542c88d58d42f0e82d68f8a6dfde3f1e88f03216f6e0d8bb93c7bb5;/codebuild/output/src3806768626/src/libs/socialgest/messenger/src/presenter/components/user-list/user-list.component.ts */\n:host {\n  position: relative;\n}\n"] }]
2611  }], () => [], null);
2612})();
2613(() => {
2614  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(UserListComponent2, { className: "UserListComponent", filePath: "libs/socialgest/messenger/src/presenter/components/user-list/user-list.component.ts", lineNumber: 33 });
2615})();
2616
2617// libs/socialgest/messenger/src/presenter/components/textarea/textarea.component.ts
2618var _c03 = ["textarea"];
2619var _c1 = (a0, a1) => ({ "ng-invalid ng-dirty": a0, "border-primary-500!": a1 });
2620var _c2 = (a0, a1) => ({ total: a0, date: a1 });
2621function TextareaComponent_ng_template_8_Template(rf, ctx) {
2622  if (rf & 1) {
2623    const _r2 = \u0275\u0275getCurrentView();
2624    \u0275\u0275elementStart(0, "ui-icon", 11);
2625    \u0275\u0275listener("click", function TextareaComponent_ng_template_8_Template_ui_icon_click_0_listener($event) {
2626      const pick_r3 = \u0275\u0275restoreView(_r2).pick;
2627      return \u0275\u0275resetView(pick_r3($event));
2628    });
2629    \u0275\u0275elementEnd();
2630  }
2631}
2632function TextareaComponent_Conditional_15_Conditional_1_Template(rf, ctx) {
2633  if (rf & 1) {
2634    \u0275\u0275elementStart(0, "span", 12);
2635    \u0275\u0275pipe(1, "translate");
2636    \u0275\u0275element(2, "ui-icon", 16);
2637    \u0275\u0275text(3);
2638    \u0275\u0275elementEnd();
2639  }
2640  if (rf & 2) {
2641    const ctx_r3 = \u0275\u0275nextContext(2);
2642    \u0275\u0275property("ngClass", ctx_r3.urlQuotaLevel() === "exhausted" ? "text-red-500" : ctx_r3.urlQuotaLevel() === "warning" ? "text-[#E9821B]" : "text-grey-300")("tooltip", \u0275\u0275pipeBind2(1, 4, "MESSENGER.COUNTERS.URL_QUOTA_TOOLTIP", \u0275\u0275pureFunction2(7, _c2, ctx_r3.urlQuotaTotal(), ctx_r3.urlQuotaResetLabel())));
2643    \u0275\u0275advance(3);
2644    \u0275\u0275textInterpolate2(" ", ctx_r3.urlQuotaUsed(), "/", ctx_r3.urlQuotaTotal(), " ");
2645  }
2646}
2647function TextareaComponent_Conditional_15_Conditional_2_Template(rf, ctx) {
2648  if (rf & 1) {
2649    \u0275\u0275elementStart(0, "span", 13);
2650    \u0275\u0275pipe(1, "translate");
2651    \u0275\u0275text(2);
2652    \u0275\u0275elementEnd();
2653  }
2654  if (rf & 2) {
2655    const ctx_r3 = \u0275\u0275nextContext(2);
2656    \u0275\u0275property("ngClass", ctx_r3.store.post().get.message.cashtags > ctx_r3.cashtagMax ? "text-red-500" : "text-grey-300")("tooltip", \u0275\u0275pipeBind1(1, 4, "MESSENGER.COUNTERS.CASHTAGS_TOOLTIP"));
2657    \u0275\u0275advance(2);
2658    \u0275\u0275textInterpolate2(" $ ", ctx_r3.store.post().get.message.cashtags, "/", ctx_r3.cashtagMax, " ");
2659  }
2660}
2661function TextareaComponent_Conditional_15_Template(rf, ctx) {
2662  if (rf & 1) {
2663    \u0275\u0275elementStart(0, "div");
2664    \u0275\u0275conditionalCreate(1, TextareaComponent_Conditional_15_Conditional_1_Template, 4, 10, "span", 12);
2665    \u0275\u0275conditionalCreate(2, TextareaComponent_Conditional_15_Conditional_2_Template, 3, 6, "span", 13);
2666    \u0275\u0275elementStart(3, "span", 14);
2667    \u0275\u0275pipe(4, "translate");
2668    \u0275\u0275text(5);
2669    \u0275\u0275elementEnd();
2670    \u0275\u0275elementStart(6, "span", 15);
2671    \u0275\u0275pipe(7, "translate");
2672    \u0275\u0275text(8);
2673    \u0275\u0275elementEnd()();
2674  }
2675  if (rf & 2) {
2676    let tmp_8_0;
2677    const ctx_r3 = \u0275\u0275nextContext();
2678    \u0275\u0275advance();
2679    \u0275\u0275conditional(ctx_r3.showUrlQuota() ? 1 : -1);
2680    \u0275\u0275advance();
2681    \u0275\u0275conditional(ctx_r3.isX() ? 2 : -1);
2682    \u0275\u0275advance();
2683    \u0275\u0275property("tooltip", \u0275\u0275pipeBind1(4, 8, "MESSENGER.COUNTERS.HASHTAGS_TOOLTIP"));
2684    \u0275\u0275advance(2);
2685    \u0275\u0275textInterpolate2(" # ", ctx_r3.store.post().get.message.hashtags, "/", ctx_r3.store.post().validator.crossUsers.rules.hashtagMax, " ");
2686    \u0275\u0275advance();
2687    \u0275\u0275property("tooltip", \u0275\u0275pipeBind1(7, 10, "MESSENGER.COUNTERS.CHARACTERS_TOOLTIP"));
2688    \u0275\u0275advance(2);
2689    \u0275\u0275textInterpolate2(" ", ctx_r3.store.post().get.message.length, "/", (tmp_8_0 = ctx_r3.store.post().validator.eachUser.rules[ctx_r3.store.userType()]) == null ? null : tmp_8_0.messageMax, " ");
2690  }
2691}
2692var TextareaComponent2 = class _TextareaComponent {
2693  placeholder = input.required();
2694  store = inject(MessengerStore);
2695  mentionRegex = inject(MentionRegexService);
2696  urlShortenerSubscriber = inject(UrlShortenerSubscriber);
2697  activeTextarea = inject(ActiveTextareaService);
2698  isTextInvalid = computed(() => {
2699    const post = this.store.post();
2700    const personalized = this.store.personalized();
2701    if (personalized.active) {
2702      const type = this.store.userType();
2703      const rules = post.validator.eachUser.rules[type];
2704      if (!rules)
2705        return false;
2706      return post.get.message.length > rules.messageMax || post.get.message.hashtags > rules.hashtagMax || post.get.message.cashtags > (rules.cashtagMax ?? Infinity);
2707    }
2708    return post.validator.crossUsers.builder.include(["message", "hashtags", "cashtags"]).validate().isLeft();
2709  });
2710  // Cashtag counter is X-only: X is the sole network that limits cashtags ($SYMBOL).
2711  isX = computed(() => this.store.userType() === UserType.X);
2712  cashtagMax = Post.X_CASHTAG_MAX;
2713  urlQuota = inject(UrlQuotaService);
2714  /**
2715   * The date this publication is being scheduled for, or null for "now".
2716   *
2717   * The quota is per billing cycle, so a post set for December is charged to
2718   * December. Reading today's cycle refused posts the API would have accepted.
2719   */
2720  scheduledAt = computed(() => {
2721    const scheduler = this.store.post().scheduler;
2722    return scheduler.is.present ? scheduler.first.date ?? null : null;
2723  });
2724  /**
2725   * What the post on screen will take once it is created.
2726   *
2727   * One per X profile, not one per post: X bills every publication
2728   * separately, so the same link sent to three profiles costs three. The
2729   * quota is committed when the publication is stored, so without this the
2730   * number sat still while the user typed the very link that would spend it.
2731   */
2732  pendingUnits = computed(() => this.store.post().urlQuotaUnits());
2733  /** Committed plus pending, in the cycle being scheduled for. */
2734  urlQuotaUsed = computed(() => this.urlQuota.usedAt(this.scheduledAt()) + this.pendingUnits());
2735  urlQuotaTotal = computed(() => this.urlQuota.totalAt(this.scheduledAt()));
2736  urlQuotaResetLabel = computed(() => this.urlQuota.resetLabelAt(this.scheduledAt()));
2737  urlQuotaLevel = computed(() => this.urlQuota.levelAt(this.scheduledAt(), this.urlQuotaUsed()));
2738  // Hidden until that cycle answers, so the counter never flashes 0/0.
2739  showUrlQuota = computed(() => this.isX() && this.urlQuota.loadedAt(this.scheduledAt()) && hasXLink(this.store.post().message.value));
2740  // Moving the date to another month asks for that month's quota.
2741  loadQuotaForDate = effect(() => {
2742    void this.urlQuota.ensureLoadedAt(this.scheduledAt());
2743  });
2744  textarea = signal(TextareaService.empty());
2745  textareaRef = viewChild.required("textarea");
2746  ngOnInit() {
2747    this.textarea.set(new TextareaService(this.textareaRef().nativeElement));
2748    this.activeTextarea.set(this.textarea());
2749    this.urlShortenerSubscriber.init(this.textarea());
2750  }
2751  highlightedMessage = computed(() => {
2752    const message = this.store.post().message.value;
2753    const regex = this.mentionRegex.getRegex();
2754    return message.replace(regex, '<a href="#" class="text-primary-400">$&</a>');
2755  });
2756  insertEmoji(emoji) {
2757    this.textarea().insertTextAtCursorPosition(emoji, { withSpace: false });
2758  }
2759  static \u0275fac = function TextareaComponent_Factory(__ngFactoryType__) {
2760    return new (__ngFactoryType__ || _TextareaComponent)();
2761  };
2762  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _TextareaComponent, selectors: [["app-textarea"]], viewQuery: function TextareaComponent_Query(rf, ctx) {
2763    if (rf & 1) {
2764      \u0275\u0275viewQuerySignal(ctx.textareaRef, _c03, 5);
2765    }
2766    if (rf & 2) {
2767      \u0275\u0275queryAdvance();
2768    }
2769  }, inputs: { placeholder: [1, "placeholder"] }, decls: 16, vars: 13, consts: [["textarea", ""], ["picker", ""], [1, "size-full", "min-h-64", "relative", "border", "border-grey-100", "rounded-base", 3, "ngClass"], ["appScrollSync", "textarea", 1, "font-sans!", "text-base", "font-normal", "leading-6", "w-full", "h-[calc(100%-3rem)]", "border-none", "outline-0", "resize-none", "p-3", "overflow-y-auto", "whitespace-pre-wrap", "[word-break:break-word]", "text-transparent", "bg-transparent", "z-10", "caret-black", 3, "ngModelChange", "ngModel"], ["contenteditable", "", "tabindex", "-1", "appScrollSync", "textarea", 1, "font-sans!", "text-base", "font-normal", "leading-6", "w-full", "h-[calc(100%-3rem)]", "absolute", "inset-0", "z-5", "border-none", "outline-0", "p-3", "overflow-y-auto", "whitespace-pre-wrap", "[word-break:break-word]", "pointer-events-none", 3, "innerHTML"], [1, "flex", "items-center", "justify-between", "px-5"], [1, "flex", "items-center", "gap-4"], [3, "valueChange"], [1, "flex", "items-center", "gap-2", "text-sm", "font-bold", "font-display!", "cursor-pointer", 3, "click"], ["name", "images/sh
2769ared/ai-logo.svg", "styleClass", "size-5 cursor-pointer"], [1, "text-gradient-primary"], ["name", "smile", "styleClass", "size-5 cursor-pointer", 3, "click"], ["tooltipPosition", "top", 1, "text-sm", "font-sans", "me-4", "inline-flex", "items-center", "gap-1", 3, "ngClass", "tooltip"], ["tooltipPosition", "top", 1, "text-sm", "font-sans", "mr-4", 3, "ngClass", "tooltip"], ["tooltipPosition", "top", 1, "text-grey-300", "text-sm", "font-sans", 3, "tooltip"], ["tooltipPosition", "top", 1, "text-grey-300", "text-sm", "font-sans", "md:ml-4", 3, "tooltip"], ["name", "link-2", "styleClass", "size-3.5"]], template: function TextareaComponent_Template(rf, ctx) {
2770    if (rf & 1) {
2771      const _r1 = \u0275\u0275getCurrentView();
2772      \u0275\u0275elementStart(0, "section", 2)(1, "textarea", 3, 0);
2773      \u0275\u0275twoWayListener("ngModelChange", function TextareaComponent_Template_textarea_ngModelChange_1_listener($event) {
2774        \u0275\u0275restoreView(_r1);
2775        \u0275\u0275twoWayBindingSet(ctx.store.post().message.value, $event) || (ctx.store.post().message.value = $event);
2776        return \u0275\u0275resetView($event);
2777      });
2778      \u0275\u0275listener("ngModelChange", function TextareaComponent_Template_textarea_ngModelChange_1_listener() {
2779        \u0275\u0275restoreView(_r1);
2780        return \u0275\u0275resetView(ctx.store.refresh());
2781      });
2782      \u0275\u0275elementEnd();
2783      \u0275\u0275element(3, "div", 4);
2784      \u0275\u0275pipe(4, "anchorme");
2785      \u0275\u0275elementStart(5, "footer", 5)(6, "div", 6)(7, "ui-emoji-picker", 7);
2786      \u0275\u0275listener("valueChange", function TextareaComponent_Template_ui_emoji_picker_valueChange_7_listener($event) {
2787        \u0275\u0275restoreView(_r1);
2788        return \u0275\u0275resetView(ctx.insertEmoji($event));
2789      });
2790      \u0275\u0275template(8, TextareaComponent_ng_template_8_Template, 1, 0, "ng-template", null, 1, \u0275\u0275templateRefExtractor);
2791      \u0275\u0275elementEnd();
2792      \u0275\u0275elementStart(10, "button", 8);
2793      \u0275\u0275listener("click", function TextareaComponent_Template_button_click_10_listener() {
2794        \u0275\u0275restoreView(_r1);
2795        return \u0275\u0275resetView(ctx.store.toggleAiTextGenerator());
2796      });
2797      \u0275\u0275element(11, "ui-icon", 9);
2798      \u0275\u0275elementStart(12, "span", 10);
2799      \u0275\u0275text(13);
2800      \u0275\u0275pipe(14, "translate");
2801      \u0275\u0275elementEnd()()();
2802      \u0275\u0275conditionalCreate(15, TextareaComponent_Conditional_15_Template, 9, 12, "div");
2803      \u0275\u0275elementEnd()();
2804    }
2805    if (rf & 2) {
2806      \u0275\u0275property("ngClass", \u0275\u0275pureFunction2(10, _c1, ctx.isTextInvalid(), ctx.store.isMention().activeForCurrentUser));
2807      \u0275\u0275advance();
2808      \u0275\u0275twoWayProperty("ngModel", ctx.store.post().message.value);
2809      \u0275\u0275advance(2);
2810      \u0275\u0275property("innerHTML", \u0275\u0275pipeBind1(4, 6, ctx.highlightedMessage()), \u0275\u0275sanitizeHtml);
2811      \u0275\u0275attribute("placeholder", ctx.placeholder());
2812      \u0275\u0275advance(10);
2813      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(14, 8, "MESSENGER.GENERATE_WITH_AI"));
2814      \u0275\u0275advance(2);
2815      \u0275\u0275conditional(ctx.store.post().userList.has.items ? 15 : -1);
2816    }
2817  }, dependencies: [
2818    CommonModule,
2819    NgClass,
2820    TranslatePipe,
2821    FormsModule,
2822    DefaultValueAccessor,
2823    NgControlStatus,
2824    NgModel,
2825    AnchormePipe,
2826    ScrollSyncDirective,
2827    EmojiPickerComponent,
2828    IconComponent,
2829    TooltipDirective
2830  ], encapsulation: 2 });
2831};
2832(() => {
2833  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TextareaComponent2, [{
2834    type: Component,
2835    args: [{ selector: "app-textarea", imports: [
2836      CommonModule,
2837      TranslatePipe,
2838      FormsModule,
2839      AnchormePipe,
2840      ScrollSyncDirective,
2841      EmojiPickerComponent,
2842      IconComponent,
2843      TooltipDirective
2844    ], template: `<section
2845  class="size-full min-h-64 relative border border-grey-100 rounded-base"
2846  [ngClass]="{ 'ng-invalid ng-dirty': isTextInvalid(), 'border-primary-500!': store.isMention().activeForCurrentUser }"
2847>
2848  <textarea
2849    #textarea
2850    [(ngModel)]="store.post().message.value"
2851    (ngModelChange)="store.refresh()"
2852    appScrollSync="textarea"
2853    class="font-sans! text-base font-normal leading-6 w-full h-[calc(100%-3rem)] border-none outline-0 resize-none p-3 overflow-y-auto whitespace-pre-wrap [word-break:break-word] text-transparent bg-transparent z-10 caret-black"
2854  ></textarea>
2855
2856  <div
2857    contenteditable
2858    tabindex="-1"
2859    appScrollSync="textarea"
2860    [innerHTML]="highlightedMessage() | anchorme"
2861    [attr.placeholder]="placeholder()"
2862    class="font-sans! text-base font-normal leading-6 w-full h-[calc(100%-3rem)] absolute inset-0 z-5 border-none outline-0 p-3 overflow-y-auto whitespace-pre-wrap [word-break:break-word] pointer-events-none"
2863  ></div>
2864
2865  <footer class="flex items-center justify-between px-5">
2866    <div class="flex items-center gap-4">
2867      <ui-emoji-picker (valueChange)="insertEmoji($event)">
2868        <ng-template #picker let-pick="pick">
2869          <ui-icon (click)="pick($event)" name="smile" styleClass="size-5 cursor-pointer" />
2870        </ng-template>
2871      </ui-emoji-picker>
2872
2873      <button
2874        (click)="store.toggleAiTextGenerator()"
2875        class="flex items-center gap-2 text-sm font-bold font-display! cursor-pointer"
2876      >
2877        <ui-icon name="images/shared/ai-logo.svg" styleClass="size-5 cursor-pointer" />
2878        <span class="text-gradient-primary">{{ 'MESSENGER.GENERATE_WITH_AI' | translate }}</span>
2879      </button>
2880    </div>
2881
2882    @if (store.post().userList.has.items) {
2883      <div>
2884        @if (showUrlQuota()) {
2885          <span
2886            class="text-sm font-sans me-4 inline-flex items-center gap-1"
2887            [ngClass]="
2888              urlQuotaLevel() === 'exhausted'
2889                ? 'text-red-500'
2890                : urlQuotaLevel() === 'warning'
2891                  ? 'text-[#E9821B]'
2892                  : 'text-grey-300'
2893            "
2894            [tooltip]="
2895              'MESSENGER.COUNTERS.URL_QUOTA_TOOLTIP'
2896                | translate: { total: urlQuotaTotal(), date: urlQuotaResetLabel() }
2897            "
2898            tooltipPosition="top"
2899          >
2900            <ui-icon name="link-2" styleClass="size-3.5" />
2901            {{ urlQuotaUsed() }}/{{ urlQuotaTotal() }}
2902          </span>
2903        }
2904
2905        @if (isX()) {
2906          <span
2907            class="text-sm font-sans mr-4"
2908            [ngClass]="store.post().get.message.cashtags > cashtagMax ? 'text-red-500' : 'text-grey-300'"
2909            [tooltip]="'MESSENGER.COUNTERS.CASHTAGS_TOOLTIP' | translate"
2910            tooltipPosition="top"
2911          >
2912            $ {{ store.post().get.message.cashtags }}/{{ cashtagMax }}
2913          </span>
2914        }
2915
2916        <span
2917          class="text-grey-300 text-sm font-sans"
2918          [tooltip]="'MESSENGER.COUNTERS.HASHTAGS_TOOLTIP' | translate"
2919          tooltipPosition="top"
2920        >
2921          # {{ store.post().get.message.hashtags }}/{{ store.post().validator.crossUsers.rules.hashtagMax }}
2922        </span>
2923
2924        <span
2925          class="text-grey-300 text-sm font-sans md:ml-4"
2926          [tooltip]="'MESSENGER.COUNTERS.CHARACTERS_TOOLTIP' | translate"
2927          tooltipPosition="top"
2928        >
2929          {{ store.post().get.message.length }}/{{ store.post().validator.eachUser.rules[store.userType()]?.messageMax }}
2930        </span>
2931      </div>
2932    }
2933  </footer>
2934</section>
2935` }]
2936  }], null, null);
2937})();
2938(() => {
2939  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(TextareaComponent2, { className: "TextareaComponent", filePath: "libs/socialgest/messenger/src/presenter/components/textarea/textarea.component.ts", lineNumber: 32 });
2940})();
2941
2942// libs/socialgest/messenger/src/presenter/components/link-preview-config/link-image.validator.ts
2943var MAX_SIZE = 3 * 1024 * 1024;
2944var MAX_DIMENSION = 3e3;
2945var ALLOWED_TYPES = ["image/png", "image/jpeg", "image/jpg", "image/webp"];
2946var dimensions = (file) => new Promise((resolve) => {
2947  const image = new Image();
2948  const url = URL.createObjectURL(file);
2949  image.onload = () => {
2950    resolve({ width: image.naturalWidth, height: image.naturalHeight });
2951    URL.revokeObjectURL(url);
2952  };
2953  image.onerror = () => {
2954    resolve({ width: 0, height: 0 });
2955    URL.revokeObjectURL(url);
2956  };
2957  image.src = url;
2958});
2959var validateLinkImage = (file) => __async(null, null, function* () {
2960  if (!ALLOWED_TYPES.includes(file.type))
2961    return "MESSENGER.LINK_PREVIEW.ERRORS.NOT_IMAGE";
2962  if (file.size > MAX_SIZE)
2963    return "MESSENGER.LINK_PREVIEW.ERRORS.MAX_SIZE";
2964  const { width, height } = yield dimensions(file);
2965  if (width > MAX_DIMENSION || height > MAX_DIMENSION)
2966    return "MESSENGER.LINK_PREVIEW.ERRORS.MAX_DIMENSION";
2967  return null;
2968});
2969
2970// libs/socialgest/messenger/src/presenter/components/link-preview-config/link-preview-config.component.ts
2971function LinkPreviewConfigComponent_Conditional_0_Conditional_16_Template(rf, ctx) {
2972  if (rf & 1) {
2973    \u0275\u0275element(0, "img", 11);
2974  }
2975  if (rf & 2) {
2976    const ctx_r2 = \u0275\u0275nextContext(2);
2977    \u0275\u0275property("src", ctx_r2.localThumbnail(), \u0275\u0275sanitizeUrl);
2978  }
2979}
2980function LinkPreviewConfigComponent_Conditional_0_Conditional_17_Template(rf, ctx) {
2981  if (rf & 1) {
2982    \u0275\u0275element(0, "ui-icon", 12);
2983  }
2984}
2985function LinkPreviewConfigComponent_Conditional_0_Conditional_25_Template(rf, ctx) {
2986  if (rf & 1) {
2987    const _r4 = \u0275\u0275getCurrentView();
2988    \u0275\u0275elementStart(0, "div", 17)(1, "ui-button", 27);
2989    \u0275\u0275pipe(2, "translate");
2990    \u0275\u0275listener("click", function LinkPreviewConfigComponent_Conditional_0_Conditional_25_Template_ui_button_click_1_listener() {
2991      \u0275\u0275restoreView(_r4);
2992      const ctx_r2 = \u0275\u0275nextContext(2);
2993      return \u0275\u0275resetView(ctx_r2.previousImage());
2994    });
2995    \u0275\u0275elementEnd();
2996    \u0275\u0275elementStart(3, "ui-button", 28);
2997    \u0275\u0275pipe(4, "translate");
2998    \u0275\u0275listener("click", function LinkPreviewConfigComponent_Conditional_0_Conditional_25_Template_ui_button_click_3_listener() {
2999      \u0275\u0275restoreView(_r4);
3000      const ctx_r2 = \u0275\u0275nextContext(2);
3001      return \u0275\u0275resetView(ctx_r2.nextImage());
3002    });
3003    \u0275\u0275elementEnd()();
3004  }
3005  if (rf & 2) {
3006    \u0275\u0275advance();
3007    \u0275\u0275property("fluid", false)("tooltip", \u0275\u0275pipeBind1(2, 4, "MESSENGER.LINK_PREVIEW.PREVIOUS_IMAGE"));
3008    \u0275\u0275advance(2);
3009    \u0275\u0275property("fluid", false)("tooltip", \u0275\u0275pipeBind1(4, 6, "MESSENGER.LINK_PREVIEW.NEXT_IMAGE"));
3010  }
3011}
3012function LinkPreviewConfigComponent_Conditional_0_Conditional_26_Template(rf, ctx) {
3013  if (rf & 1) {
3014    \u0275\u0275elementStart(0, "p", 18);
3015    \u0275\u0275element(1, "ui-icon", 29);
3016    \u0275\u0275text(2);
3017    \u0275\u0275pipe(3, "translate");
3018    \u0275\u0275elementEnd();
3019  }
3020  if (rf & 2) {
3021    \u0275\u0275advance(2);
3022    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(3, 1, "MESSENGER.LINK_PREVIEW.FACEBOOK_WARNING"), " ");
3023  }
3024}
3025function LinkPreviewConfigComponent_Conditional_0_Conditional_41_Template(rf, ctx) {
3026  if (rf & 1) {
3027    const _r5 = \u0275\u0275getCurrentView();
3028    \u0275\u0275elementStart(0, "div", 23)(1, "ui-toggle", 30);
3029    \u0275\u0275listener("enable", function LinkPreviewConfigComponent_Conditional_0_Conditional_41_Template_ui_toggle_enable_1_listener() {
3030      \u0275\u0275restoreView(_r5);
3031      const ctx_r2 = \u0275\u0275nextContext(2);
3032      return \u0275\u0275resetView(ctx_r2.toggleHideImage(true));
3033    })("disable", function LinkPreviewConfigComponent_Conditional_0_Conditional_41_Template_ui_toggle_disable_1_listener() {
3034      \u0275\u0275restoreView(_r5);
3035      const ctx_r2 = \u0275\u0275nextContext(2);
3036      return \u0275\u0275resetView(ctx_r2.toggleHideImage(false));
3037    });
3038    \u0275\u0275elementEnd();
3039    \u0275\u0275elementStart(2, "span", 31);
3040    \u0275\u0275text(3);
3041    \u0275\u0275pipe(4, "translate");
3042    \u0275\u0275elementEnd()();
3043  }
3044  if (rf & 2) {
3045    const ctx_r2 = \u0275\u0275nextContext(2);
3046    \u0275\u0275advance();
3047    \u0275\u0275property("ngModel", ctx_r2.localHideImage());
3048    \u0275\u0275advance(2);
3049    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 2, "MESSENGER.LINK_PREVIEW.HIDE_IMAGE_LINKEDIN"));
3050  }
3051}
3052function LinkPreviewConfigComponent_Conditional_0_Template(rf, ctx) {
3053  if (rf & 1) {
3054    const _r1 = \u0275\u0275getCurrentView();
3055    \u0275\u0275elementStart(0, "ui-button", 1);
3056    \u0275\u0275listener("click", function LinkPreviewConfigComponent_Conditional_0_Template_ui_button_click_0_listener($event) {
3057      \u0275\u0275restoreView(_r1);
3058      const popover_r2 = \u0275\u0275reference(2);
3059      const ctx_r2 = \u0275\u0275nextContext();
3060      ctx_r2.open();
3061      return \u0275\u0275resetView(popover_r2.toggle($event));
3062    });
3063    \u0275\u0275elementEnd();
3064    \u0275\u0275elementStart(1, "ui-popover", 2, 0)(3, "article", 3)(4, "header", 4)(5, "h3", 5);
3065    \u0275\u0275text(6);
3066    \u0275\u0275pipe(7, "translate");
3067    \u0275\u0275elementEnd();
3068    \u0275\u0275element(8, "ui-icon", 6);
3069    \u0275\u0275pipe(9, "translate");
3070    \u0275\u0275elementEnd();
3071    \u0275\u0275elementStart(10, "section", 7)(11, "span", 8);
3072    \u0275\u0275text(12);
3073    \u0275\u0275pipe(13, "translate");
3074    \u0275\u0275elementEnd();
3075    \u0275\u0275elementStart(14, "div", 9)(15, "figure", 10);
3076    \u0275\u0275conditionalCreate(16, LinkPreviewConfigComponent_Conditional_0_Conditional_16_Template, 1, 1, "img", 11)(17, LinkPreviewConfigComponent_Conditional_0_Conditional_17_Template, 1, 0, "ui-icon", 12);
3077    \u0275\u0275elementEnd();
3078    \u0275\u0275elementStart(18, "div", 13)(19, "label", 14);
3079    \u0275\u0275pipe(20, "translate");
3080    \u0275\u0275element(21, "ui-icon", 15);
3081    \u0275\u0275text(22);
3082    \u0275\u0275pipe(23, "translate");
3083    \u0275\u0275elementStart(24, "input", 16);
3084    \u0275\u0275listener("change", function LinkPreviewConfigComponent_Conditional_0_Template_input_change_24_listener($event) {
3085      \u0275\u0275restoreView(_r1);
3086      const ctx_r2 = \u0275\u0275nextContext();
3087      return \u0275\u0275resetView(ctx_r2.uploadImage($event));
3088    });
3089    \u0275\u0275elementEnd()();
3090    \u0275\u0275conditionalCreate(25, LinkPreviewConfigComponent_Conditional_0_Conditional_25_Template, 5, 8, "div", 17);
3091    \u0275\u0275elementEnd()();
3092    \u0275\u0275conditionalCreate(26, LinkPreviewConfigComponent_Conditional_0_Conditional_26_Template, 4, 3, "p", 18);
3093    \u0275\u0275elementEnd();
3094    \u0275\u0275elementStart(27, "div", 19)(28, "span", 8);
3095    \u0275\u0275text(29);
3096    \u0275\u0275pipe(30, "translate");
3097    \u0275\u0275elementEnd();
3098    \u0275\u0275element(31, "ui-input-text", 20);
3099    \u0275\u0275elementStart(32, "span", 21);
3100    \u0275\u0275text(33);
3101    \u0275\u0275elementEnd()();
3102    \u0275\u0275elementStart(34, "div", 19)(35, "span", 8);
3103    \u0275\u0275text(36);
3104    \u0275\u0275pipe(37, "translate");
3105    \u0275\u0275elementEnd();
3106    \u0275\u0275element(38, "ui-textarea", 22);
3107    \u0275\u0275elementStart(39, "span", 21);
3108    \u0275\u0275text(40);
3109    \u0275\u0275elementEnd()();
3110    \u0275\u0275conditionalCreate(41, LinkPreviewConfigComponent_Conditional_0_Conditional_41_Template, 5, 4, "div", 23);
3111    \u0275\u0275elementStart(42, "footer", 24)(43, "ui-button", 25);
3112    \u0275\u0275listener("click", function LinkPreviewConfigComponent_Conditional_0_Template_ui_button_click_43_listener() {
3113      \u0275\u0275restoreView(_r1);
3114      const popover_r2 = \u0275\u0275reference(2);
3115      return \u0275\u0275resetView(popover_r2.hide());
3116    });
3117    \u0275\u0275elementEnd();
3118    \u0275\u0275elementStart(44, "ui-button", 26);
3119    \u0275\u0275listener("click", function LinkPreviewConfigComponent_Conditional_0_Template_ui_button_click_44_listener() {
3120      \u0275\u0275restoreView(_r1);
3121      const popover_r2 = \u0275\u0275reference(2);
3122      const ctx_r2 = \u0275\u0275nextContext();
3123      ctx_r2.save();
3124      return \u0275\u0275resetView(popover_r2.hide());
3125    });
3126    \u0275\u0275elementEnd()()()();
3127  }
3128  if (rf & 2) {
3129    const ctx_r2 = \u0275\u0275nextContext();
3130    \u0275\u0275property("fluid", false)("variant", ctx_r2.isActive() ? "outlined" : void 0);
3131    \u0275\u0275advance(6);
3132    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(7, 34, "MESSENGER.LINK_PREVIEW.TITLE"));
3133    \u0275\u0275advance(2);
3134    \u0275\u0275property("tooltip", \u0275\u0275pipeBind1(9, 36, "MESSENGER.LINK_PREVIEW.INFO"));
3135    \u0275\u0275advance(4);
3136    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(13, 38, "MESSENGER.LINK_PREVIEW.LINK_PREVIEW"), " ");
3137    \u0275\u0275advance(4);
3138    \u0275\u0275conditional(ctx_r2.localThumbnail() && !ctx_r2.localHideImage() ? 16 : 17);
3139    \u0275\u0275advance(3);
3140    \u0275\u0275classProp("opacity-50", !ctx_r2.canChangeImage() || ctx_r2.isLoading())("pointer-events-none", !ctx_r2.canChangeImage() || ctx_r2.isLoading());
3141    \u0275\u0275property("tooltip", \u0275\u0275pipeBind1(20, 40, "MESSENGER.LINK_PREVIEW.THUMBNAIL_HINT"));
3142    \u0275\u0275advance(2);
3143    \u0275\u0275property("name", ctx_r2.isLoading() ? "loaderCircle" : "pencil")("styleClass", ctx_r2.isLoading() ? "size-4 animate-spin" : "size-4");
3144    \u0275\u0275advance();
3145    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(23, 42, "MESSENGER.LINK_PREVIEW.CHANGE_THUMBNAIL"), " ");
3146    \u0275\u0275advance(2);
3147    \u0275\u0275property("disabled", !ctx_r2.canChangeImage() || ctx_r2.isLoading());
3148    \u0275\u0275advance();
3149    \u0275\u0275conditional(ctx_r2.images().length > 1 && ctx_r2.canChangeImage() ? 25 : -1);
3150    \u0275\u0275advance();
3151    \u0275\u0275conditional(ctx_r2.isFacebook() && !ctx_r2.isShortener() ? 26 : -1);
3152    \u0275\u0275advance(3);
3153    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(30, 44, "MESSENGER.LINK_PREVIEW.FIELD_TITLE"));
3154    \u0275\u0275advance(2);
3155    \u0275\u0275property("formControl", ctx_r2.form.controls.title);
3156    \u0275\u0275advance();
3157    \u0275\u0275classProp("text-red-500", ctx_r2.titleOverLimit());
3158    \u0275\u0275advance();
3159    \u0275\u0275textInterpolate2(" ", ctx_r2.titleLength(), "/", ctx_r2.TITLE_MAX, " ");
3160    \u0275\u0275advance(3);
3161    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(37, 46, "MESSENGER.LINK_PREVIEW.FIELD_DESCRIPTION"), " ");
3162    \u0275\u0275advance(2);
3163    \u0275\u0275property("formControl", ctx_r2.form.controls.description)("rows", 3);
3164    \u0275\u0275advance();
3165    \u0275\u0275classProp("text-red-500", ctx_r2.descriptionOverLimit());
3166    \u0275\u0275advance();
3167    \u0275\u0275textInterpolate2(" ", ctx_r2.descriptionLength(), "/", ctx_r2.DESCRIPTION_MAX, " ");
3168    \u0275\u0275advance();
3169    \u0275\u0275conditional(ctx_r2.isLinkedin() ? 41 : -1);
3170    \u0275\u0275advance(2);
3171    \u0275\u0275property("fluid", false);
3172    \u0275\u0275advance();
3173    \u0275\u0275property("disabled", ctx_r2.form.invalid)("fluid", false);
3174  }
3175}
3176var TITLE_MAX = 90;
3177var DESCRIPTION_MAX = 170;
3178var APPLICABLE_TYPES = [UserType.FACEBOOK, UserType.LINKEDIN];
3179var LinkPreviewConfigComponent = class _LinkPreviewConfigComponent {
3180  store = inject(MessengerStore);
3181  linkStore = inject(linkStore);
3182  toast = inject(SonnerToasterService);
3183  shortener = inject(SocialgestShortenerService);
3184  TITLE_MAX = TITLE_MAX;
3185  DESCRIPTION_MAX = DESCRIPTION_MAX;
3186  isLoading = signal(false);
3187  localIndex = signal(0);
3188  localImage = signal("");
3189  localHideImage = signal(false);
3190  form = new FormGroup({
3191    title: new FormControl("", { nonNullable: true, validators: [Validators.maxLength(TITLE_MAX)] }),
3192    description: new FormControl("", { nonNullable: true, validators: [Validators.maxLength(DESCRIPTION_MAX)] })
3193  });
3194  titleValue = toSignal(this.form.controls.title.valueChanges, {
3195    initialValue: this.form.controls.title.value
3196  });
3197  descriptionValue = toSignal(this.form.controls.description.valueChanges, {
3198    initialValue: this.form.controls.description.value
3199  });
3200  titleLength = computed(() => this.titleValue().length);
3201  descriptionLength = computed(() => this.descriptionValue().length);
3202  titleOverLimit = computed(() => this.titleLength() > TITLE_MAX);
3203  descriptionOverLimit = computed(() => this.descriptionLength() > DESCRIPTION_MAX);
3204  canShow = computed(() => {
3205    const hasLink = !!this.linkStore.link();
3206    const noMedia = this.store.post().multimediaList.isEmpty;
3207    return hasLink && noMedia && APPLICABLE_TYPES.includes(this.store.userType());
3208  });
3209  isActive = computed(() => this.store.post().linkPreview.has.any);
3210  isLinkedin = computed(() => this.store.userType() === UserType.LINKEDIN);
3211  isFacebook = computed(() => this.store.userType() === UserType.FACEBOOK);
3212  shortenerLink = computed(() => $string.shortenedUrls(this.store.post().message.value)[0] ?? "");
3213  isShortener = computed(() => !!this.shortenerLink());
3214  canChangeImage = computed(() => this.isShortener() || !this.isFacebook());
3215  images = computed(() => this.linkStore.link()?.images ?? []);
3216  localThumbnail = computed(() => this.localImage() || this.images()[this.localIndex()] || this.linkStore.link()?.image || "");
3217  open() {
3218    const linkPreview = this.store.post().linkPreview;
3219    const scraped = this.linkStore.link();
3220    this.form.controls.title.setValue(linkPreview.title || scraped?.title || "");
3221    this.form.controls.description.setValue(linkPreview.description || scraped?.description || "");
3222    this.form.markAllAsTouched();
3223    this.localIndex.set(linkPreview.index);
3224    this.localImage.set(linkPreview.image);
3225    this.localHideImage.set(linkPreview.hideImage);
3226  }
3227  save() {
3228    if (this.form.invalid)
3229      return;
3230    const linkPreview = this.store.post().linkPreview;
3231    linkPreview.set.title(this.form.controls.title.value.trim());
3232    linkPreview.set.description(this.form.controls.description.value.trim());
3233    linkPreview.set.index(this.localIndex());
3234    linkPreview.set.image(this.localImage());
3235    linkPreview.set.hideImage(this.localHideImage());
3236    this.store.refresh();
3237    this.persistToShortener();
3238  }
3239  persistToShortener() {
3240    const link = this.shortenerLink();
3241    const code = link.split("/").filter(Boolean).pop();
3242    if (!code)
3243      return;
3244    const preview = {
3245      image: this.localHideImage() ? "" : this.localThumbnail(),
3246      title: this.form.controls.title.value.trim(),
3247      description: this.form.controls.description.value.trim()
3248    };
3249    lastValueFrom(this.shortener.getData(code)).then((data) => {
3250      data.mapLeft((error) => this.toast.error(new Exception(error.message)));
3251      data.mapRight(({ createdAt }) => lastValueFrom(this.shortener.editPreview(__spreadValues({ createdAt }, preview))).then((result) => result.mapLeft((error) => this.toast.error(new Exception(error.message)))));
3252    });
3253  }
3254  nextImage() {
3255    this.cycleImage(1);
3256  }
3257  previousImage() {
3258    this.cycleImage(-1);
3259  }
3260  cycleImage(delta) {
3261    const count = this.images().length;
3262    if (count === 0)
3263      return;
3264    this.localImage.set("");
3265    this.localIndex.set((this.localIndex() + delta + count) % count);
3266  }
3267  uploadImage(event) {
3268    return __async(this, null, function* () {
3269      const input2 = event.target;
3270      const file = input2.files?.[0];
3271      input2.value = "";
3272      if (!file)
3273        return;
3274      const error = yield validateLinkImage(file);
3275      if (error) {
3276        this.toast.error(new Exception(error));
3277        return;
3278      }
3279      this.isLoading.set(true);
3280      const result = yield uploaderService.fromFile(file).complete();
3281      this.isLoading.set(false);
3282      result.mapRight((url) => this.localImage.set(url));
3283      result.mapLeft((uploadError) => this.toast.error(new Exception(uploadError.message)));
3284    });
3285  }
3286  toggleHideImage(active) {
3287    this.localHideImage.set(active);
3288  }
3289  static \u0275fac = function LinkPreviewConfigComponent_Factory(__ngFactoryType__) {
3290    return new (__ngFactoryType__ || _LinkPreviewConfigComponent)();
3291  };
3292  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _LinkPreviewConfigComponent, selectors: [["app-link-preview-config"]], decls: 1, vars: 1, consts: [["popover", ""], ["label", "MESSENGER.LINK_PREVIEW.PERSONALIZE", "severity", "secondary", "size", "small", 3, "click", "fluid", "variant"], ["styleClass", "w-[23.125rem] no-gutter mt-4!"], [1, "flex", "flex-col", "gap-4", "p-5"], [1, "flex", "items-center", "gap-2"], [1, "text-base", "font-bold"], ["name", "info", "styleClass", "size-4 text-grey-300", "tooltipPosition", "top", 3, "tooltip"], [1, "flex", "flex-col", "gap-2"], [1, "text-sm", "font-semibold", "text-grey-400"], [1, "flex", "items-center", "gap-3"], [1, "size-16", "shrink-0", "rounded-lg", "bg-grey-50", "overflow-hidden", "flex", "items-center", "justify-center"], ["alt", "", 1, "size-full", "object-cover", 3, "src"], ["name", "image", "styleClass", "size-6 text-grey-200"], [1, "flex", "flex-col", "flex-1", "gap-1"], ["tooltipPosition", "top", 1, "flex", "items-center", "gap-2", "px-3", "py-1.5", "rounded-lg", "border", "border-grey-100", "hover:bg-grey-50/50", "transition-colors", "text-sm", "font-semibold", "cursor-pointer", 3, "tooltip"], [3, "name", "styleClass"], ["type", "file", "accept", "image/png,image/jpeg,image/webp", "hidden", "", 3, "change", "disabled"], [1, "flex", "gap-1"], [1, "flex", "items-start", "gap-2", "rounded-lg", "bg-amber-50", "p-2.5", "text-xs", "font-medium", "text-amber-700"], [1, "flex", "flex-col", "gap-1.5"], [3, "formControl"], [1, "self-end", "text-xs", "text-grey-300"], [3, "formControl", "rows"], [1, "flex", "items-center", "gap-2.5"], [1, "flex", "items-center", "justify-end", "gap-3"], ["label", "MESSENGER.LINK_PREVIEW.CLOSE", "severity", "contrast", 3, "click", "fluid"], ["label", "MESSENGER.LINK_PREVIEW.SAVE", 3, "click", "disabled", "fluid"], ["icon", "chevronLeft", "severity", "contrast", "size", "small", 3, "click", "fluid", "tooltip"], ["icon", "chevronRight", "severity", "contrast", "size", "small", 3, "click", "fluid", "tooltip"], ["name", "triangleAlert", "styleClass", "size-4 shrink-0 text-amber-500"], [3, "enable", "disable", "ngModel"], [1, "text-sm", "text-grey-400"]], template: function LinkPreviewConfigComponent_Template(rf, ctx) {
3293    if (rf & 1) {
3294      \u0275\u0275conditionalCreate(0, LinkPreviewConfigComponent_Conditional_0_Template, 45, 48);
3295    }
3296    if (rf & 2) {
3297      \u0275\u0275conditional(ctx.canShow() ? 0 : -1);
3298    }
3299  }, dependencies: [
3300    CommonModule,
3301    FormsModule,
3302    NgControlStatus,
3303    NgModel,
3304    ReactiveFormsModule,
3305    FormControlDirective,
3306    TranslatePipe,
3307    ButtonComponent,
3308    IconComponent,
3309    InputTextComponent,
3310    TextareaComponent,
3311    ToggleComponent,
3312    PopoverComponent,
3313    TooltipDirective
3314  ], encapsulation: 2 });
3315};
3316(() => {
3317  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(LinkPreviewConfigComponent, [{
3318    type: Component,
3319    args: [{ selector: "app-link-preview-config", imports: [
3320      CommonModule,
3321      FormsModule,
3322      ReactiveFormsModule,
3323      TranslatePipe,
3324      ButtonComponent,
3325      IconComponent,
3326      InputTextComponent,
3327      TextareaComponent,
3328      ToggleComponent,
3329      PopoverComponent,
3330      TooltipDirective
3331    ], template: `@if (canShow()) {
3332<ui-button
3333  (click)="open(); popover.toggle($event)"
3334  label="MESSENGER.LINK_PREVIEW.PERSONALIZE"
3335  severity="secondary"
3336  size="small"
3337  [fluid]="false"
3338  [variant]="isActive() ? 'outlined' : undefined"
3339/>
3340
3341<ui-popover #popover styleClass="w-[23.125rem] no-gutter mt-4!">
3342  <article class="flex flex-col gap-4 p-5">
3343    <header class="flex items-center gap-2">
3344      <h3 class="text-base font-bold">{{ 'MESSENGER.LINK_PREVIEW.TITLE' | translate }}</h3>
3345      <ui-icon
3346        name="info"
3347        styleClass="size-4 text-grey-300"
3348        [tooltip]="'MESSENGER.LINK_PREVIEW.INFO' | translate"
3349        tooltipPosition="top"
3350      />
3351    </header>
3352
3353    <section class="flex flex-col gap-2">
3354      <span class="text-sm font-semibold text-grey-400">
3355        {{ 'MESSENGER.LINK_PREVIEW.LINK_PREVIEW' | translate }}
3356      </span>
3357
3358      <div class="flex items-center gap-3">
3359        <figure class="size-16 shrink-0 rounded-lg bg-grey-50 overflow-hidden flex items-center justify-center">
3360          @if (localThumbnail() && !localHideImage()) {
3361          <img [src]="localThumbnail()" alt="" class="size-full object-cover" />
3362          } @else {
3363          <ui-icon name="image" styleClass="size-6 text-grey-200" />
3364          }
3365        </figure>
3366
3367        <div class="flex flex-col flex-1 gap-1">
3368          <label
3369            class="flex items-center gap-2 px-3 py-1.5 rounded-lg border border-grey-100 hover:bg-grey-50/50 transition-colors text-sm font-semibold cursor-pointer"
3370            [class.opacity-50]="!canChangeImage() || isLoading()"
3371            [class.pointer-events-none]="!canChangeImage() || isLoading()"
3372            [tooltip]="'MESSENGER.LINK_PREVIEW.THUMBNAIL_HINT' | translate"
3373            tooltipPosition="top"
3374          >
3375            <ui-icon
3376              [name]="isLoading() ? 'loaderCircle' : 'pencil'"
3377              [styleClass]="isLoading() ? 'size-4 animate-spin' : 'size-4'"
3378            />
3379            {{ 'MESSENGER.LINK_PREVIEW.CHANGE_THUMBNAIL' | translate }}
3380            <input
3381              type="file"
3382              accept="image/png,image/jpeg,image/webp"
3383              hidden
3384              [disabled]="!canChangeImage() || isLoading()"
3385              (change)="uploadImage($event)"
3386            />
3387          </label>
3388
3389          @if (images().length > 1 && canChangeImage()) {
3390          <div class="flex gap-1">
3391            <ui-button
3392              (click)="previousImage()"
3393              icon="chevronLeft"
3394              severity="contrast"
3395              size="small"
3396              [fluid]="false"
3397              [tooltip]="'MESSENGER.LINK_PREVIEW.PREVIOUS_IMAGE' | translate"
3398            />
3399            <ui-button
3400              (click)="nextImage()"
3401              icon="chevronRight"
3402              severity="contrast"
3403              size="small"
3404              [fluid]="false"
3405              [tooltip]="'MESSENGER.LINK_PREVIEW.NEXT_IMAGE' | translate"
3406            />
3407          </div>
3408          }
3409        </div>
3410      </div>
3411
3412      @if (isFacebook() && !isShortener()) {
3413      <p class="flex items-start gap-2 rounded-lg bg-amber-50 p-2.5 text-xs font-medium text-amber-700">
3414        <ui-icon name="triangleAlert" styleClass="size-4 shrink-0 text-amber-500" />
3415        {{ 'MESSENGER.LINK_PREVIEW.FACEBOOK_WARNING' | translate }}
3416      </p>
3417      }
3418    </section>
3419
3420    <div class="flex flex-col gap-1.5">
3421      <span class="text-sm font-semibold text-grey-400">{{ 'MESSENGER.LINK_PREVIEW.FIELD_TITLE' | translate }}</span>
3422      <ui-input-text [formControl]="form.controls.title" />
3423      <span class="self-end text-xs text-grey-300" [class.text-red-500]="titleOverLimit()">
3424        {{ titleLength() }}/{{ TITLE_MAX }}
3425      </span>
3426    </div>
3427
3428    <div class="flex flex-col gap-1.5">
3429      <span class="text-sm font-semibold text-grey-400">
3430        {{ 'MESSENGER.LINK_PREVIEW.FIELD_DESCRIPTION' | translate }}
3431      </span>
3432      <ui-textarea [formControl]="form.controls.description" [rows]="3" />
3433      <span class="self-end text-xs text-grey-300" [class.text-red-500]="descriptionOverLimit()">
3434        {{ descriptionLength() }}/{{ DESCRIPTION_MAX }}
3435      </span>
3436    </div>
3437
3438    @if (isLinkedin()) {
3439    <div class="flex items-center gap-2.5">
3440      <ui-toggle [ngModel]="localHideImage()" (enable)="toggleHideImage(true)" (disable)="toggleHideImage(false)" />
3441      <span class="text-sm text-grey-400">{{ 'MESSENGER.LINK_PREVIEW.HIDE_IMAGE_LINKEDIN' | translate }}</span>
3442    </div>
3443    }
3444
3445    <footer class="flex items-center justify-end gap-3">
3446      <ui-button (click)="popover.hide()" label="MESSENGER.LINK_PREVIEW.CLOSE" severity="contrast" [fluid]="false" />
3447      <ui-button
3448        (click)="save(); popover.hide()"
3449        label="MESSENGER.LINK_PREVIEW.SAVE"
3450        [disabled]="form.invalid"
3451        [fluid]="false"
3452      />
3453    </footer>
3454  </article>
3455</ui-popover>
3456}
3457` }]
3458  }], null, null);
3459})();
3460(() => {
3461  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(LinkPreviewConfigComponent, { className: "LinkPreviewConfigComponent", filePath: "libs/socialgest/messenger/src/presenter/components/link-preview-config/link-preview-config.component.ts", lineNumber: 47 });
3462})();
3463
3464// libs/socialgest/messenger/src/application/shorten-url/shorten-url.usecase.ts
3465var ShortenUrlUseCase = class extends UseCase {
3466  execute(input2) {
3467    return __async(this, null, function* () {
3468      const result = yield lastValueFrom(input2.provider.create(input2.options));
3469      result.mapRight((shortResult) => this.bus.publish(new LinkShortenedEvent(shortResult.shortUrl)));
3470      this.complete(result);
3471      return result;
3472    });
3473  }
3474};
3475
3476// libs/socialgest/messenger/src/application/schedule/schedule.usecase.ts
3477var SchedulePostUseCase = class extends UseCase {
3478  messengerService;
3479  constructor(messengerService) {
3480    super(progressBuilder().withStart("GLOBAL.PROGRESS.VALIDATING").withComplete("MESSENGER.SCHEDULE_SUCCESS").build());
3481    this.messengerService = messengerService;
3482  }
3483  execute(input2) {
3484    return __async(this, null, function* () {
3485      this.start();
3486      const result = yield lastValueFrom(this.messengerService.schedule(input2));
3487      result.mapRight(() => this.bus.publish(new PostScheduledEvent(input2)));
3488      this.complete(result);
3489      return result;
3490    });
3491  }
3492};
3493
3494// libs/socialgest/messenger/src/application/draft/draft.usecase.ts
3495var DraftPostUseCase = class extends UseCase {
3496  messengerService;
3497  constructor(messengerService) {
3498    super(progressBuilder().withStart("GLOBAL.PROGRESS.VALIDATING").withComplete("MESSENGER.DRAFT_SUCCESS").build());
3499    this.messengerService = messengerService;
3500  }
3501  execute(input2) {
3502    return __async(this, null, function* () {
3503      this.start();
3504      const result = yield lastValueFrom(this.messengerService.draft(input2));
3505      result.mapRight(() => this.bus.publish(new PostDraftedEvent(input2)));
3506      this.complete(result);
3507      return result;
3508    });
3509  }
3510};
3511
3512// libs/socialgest/messenger/src/application/send-to-approval/send-to-approval.usecase.ts
3513var SendToApprovalPostUseCase = class extends UseCase {
3514  messengerService;
3515  constructor(messengerService) {
3516    super(progressBuilder().withStart("GLOBAL.PROGRESS.VALIDATING").withComplete("MESSENGER.SEND_TO_APPROVAL_SUCCESS").build());
3517    this.messengerService = messengerService;
3518  }
3519  execute(input2) {
3520    return __async(this, null, function* () {
3521      this.start();
3522      const result = yield lastValueFrom(this.messengerService.sendToApproval(input2));
3523      result.mapRight(() => this.bus.publish(new PostSentToApprovalEvent(input2)));
3524      this.complete(result);
3525      return result;
3526    });
3527  }
3528};
3529
3530// libs/socialgest/messenger/src/application/publish-now/publish-now.usecase.ts
3531var PublishNowPostUseCase = class extends UseCase {
3532  messengerService;
3533  constructor(messengerService) {
3534    super(progressBuilder().withStart("GLOBAL.PROGRESS.VALIDATING").withComplete("MESSENGER.PUBLISH_NOW_QUEUED").build());
3535    this.messengerService = messengerService;
3536  }
3537  execute(input2) {
3538    return __async(this, null, function* () {
3539      this.start();
3540      const result = yield lastValueFrom(this.messengerService.publishNow(input2));
3541      result.mapRight(() => this.bus.publish(new PostPublishedNowEvent(input2)));
3542      this.complete(result);
3543      return result;
3544    });
3545  }
3546};
3547
3548// libs/socialgest/messenger/src/application/update/update.usecase.ts
3549var UpdatePostUseCase = class extends UseCase {
3550  messengerService;
3551  constructor(messengerService) {
3552    super(progressBuilder().withStart("GLOBAL.PROGRESS.VALIDATING").withComplete("MESSENGER.UPDATE_SUCCESS").build());
3553    this.messengerService = messengerService;
3554  }
3555  execute(input2) {
3556    return __async(this, null, function* () {
3557      this.start();
3558      const result = yield lastValueFrom(this.messengerService.update(input2));
3559      result.mapRight(() => this.bus.publish(new PostUpdatedEvent(input2)));
3560      this.complete(result);
3561      return result;
3562    });
3563  }
3564};
3565
3566// libs/socialgest/messenger/src/application/send-to-push/send-to-push.usecase.ts
3567var SendToPushPostUseCase = class extends UseCase {
3568  messengerService;
3569  constructor(messengerService) {
3570    super(progressBuilder().withStart("GLOBAL.PROGRESS.VALIDATING").withComplete("MESSENGER.SCHEDULE_SUCCESS").build());
3571    this.messengerService = messengerService;
3572  }
3573  execute(input2) {
3574    return __async(this, null, function* () {
3575      this.start();
3576      const result = yield lastValueFrom(this.messengerService.sendToPush(input2));
3577      result.mapRight(() => this.bus.publish(new PostSentToPushEvent(input2)));
3578      this.complete(result);
3579      return result;
3580    });
3581  }
3582};
3583
3584// libs/socialgest/messenger/src/application/publish-personalized/publish-personalized.usecase.ts
3585var actionConfig = {
3586  publishNow: { event: PostPublishedNowEvent, success: "MESSENGER.PUBLISH_NOW_SUCCESS" },
3587  schedule: { event: PostScheduledEvent, success: "MESSENGER.SCHEDULE_SUCCESS" },
3588  draft: { event: PostDraftedEvent, success: "MESSENGER.DRAFT_SUCCESS" },
3589  sendToApproval: { event: PostSentToApprovalEvent, success: "MESSENGER.SEND_TO_APPROVAL_SUCCESS" },
3590  sendToPush: { event: PostSentToPushEvent, success: "MESSENGER.SEND_TO_PUSH_SUCCESS" }
3591};
3592var PublishPersonalizedUseCase = class extends UseCase {
3593  messengerService;
3594  constructor(messengerService) {
3595    super();
3596    this.messengerService = messengerService;
3597  }
3598  execute(input2) {
3599    return __async(this, null, function* () {
3600      const config = actionConfig[input2.action];
3601      const progress = progressBuilder().withStart("GLOBAL.PROGRESS.VALIDATING").withComplete(config.success).build();
3602      progress.start();
3603      const userTypes = Object.keys(input2.personalizedMap).map(Number);
3604      const failedTypes = [];
3605      let lastError = new Error("GLOBAL.ERROR.UNEXPECTED");
3606      for (const userType of userTypes) {
3607        const data = input2.personalizedMap[String(userType)];
3608        const networkPost = input2.basePost.copy();
3609        networkPost.set.message(data.message);
3610        networkPost.set.multimediaList(data.multimediaList);
3611        networkPost.set.threadPosts(data.threadPosts);
3612        networkPost.set.userList(input2.basePost.userList.get(userType));
3613        if (data.options)
3614          networkPost.set.options(networkPost.options.withFor(userType, data.options));
3615        const result = yield lastValueFrom(this.messengerService[input2.action](networkPost));
3616        if (result.isRight()) {
3617          input2.onPostReady(networkPost);
3618        } else {
3619          failedTypes.push(userType);
3620          lastError = result.value;
3621        }
3622      }
3623      if (failedTypes.length > 0) {
3624        input2.onPartialSuccess(failedTypes);
3625        UseCaseProgress.completeFor(lastError).complete();
3626        return esm_exports.left(lastError);
3627      }
3628      bus.publish(new config.event(input2.basePost));
3629      progress.complete();
3630      return esm_exports.right(void 0);
3631    });
3632  }
3633};
3634
3635// libs/socialgest/messenger/src/application/save-idea/save-idea.usecase.ts
3636var SaveIdeaUseCase = class extends UseCase {
3637  messengerService;
3638  constructor(messengerService) {
3639    super(progressBuilder().withStart("GLOBAL.PROGRESS.VALIDATING").withComplete("MESSENGER.IDEA_SAVED_SUCCESS").build());
3640    this.messengerService = messengerService;
3641  }
3642  execute(input2) {
3643    return __async(this, null, function* () {
3644      this.start();
3645      const result = yield lastValueFrom(this.messengerService.saveIdea(input2));
3646      result.mapRight(() => this.bus.publish(new PostIdeaSavedEvent(input2)));
3647      this.complete(result);
3648      return result;
3649    });
3650  }
3651};
3652
3653// libs/socialgest/messenger/src/application/index.ts
3654var MessengerFacade = class _MessengerFacade {
3655  messengerService = inject(MessengerService);
3656  store = inject(MessengerStore);
3657  personalizedService = inject(MessengerPersonalizedService);
3658  shortenerResolver = inject(ShortenerResolver);
3659  shortenerConfig = inject(ShortenerConfigStore);
3660  shortenUrl(options, provider = this.shortenerConfig.get().provider) {
3661    return new ShortenUrlUseCase().execute({
3662      provider: this.shortenerResolver.resolve(provider),
3663      options
3664    });
3665  }
3666  schedule(input2) {
3667    return new SchedulePostUseCase(this.messengerService).execute(input2);
3668  }
3669  draft(input2) {
3670    return new DraftPostUseCase(this.messengerService).execute(input2);
3671  }
3672  sendToApproval(input2) {
3673    return new SendToApprovalPostUseCase(this.messengerService).execute(input2);
3674  }
3675  sendToPush(input2) {
3676    return new SendToPushPostUseCase(this.messengerService).execute(input2);
3677  }
3678  publishNow(input2) {
3679    return new PublishNowPostUseCase(this.messengerService).execute(input2);
3680  }
3681  update(input2) {
3682    return new UpdatePostUseCase(this.messengerService).execute(input2);
3683  }
3684  saveIdea(input2) {
3685    return new SaveIdeaUseCase(this.messengerService).execute(input2);
3686  }
3687  publishPersonalized(action, basePost, personalizedMap) {
3688    return new PublishPersonalizedUseCase(this.messengerService).execute({
3689      action,
3690      basePost,
3691      personalizedMap,
3692      onPostReady: (post) => this.store.withPost(post),
3693      onPartialSuccess: (failedTypes) => {
3694        const failedMap = {};
3695        for (const type of failedTypes) {
3696          failedMap[String(type)] = personalizedMap[String(type)];
3697        }
3698        this.store.withPersonalized({ active: true, map: failedMap });
3699        const firstFailedType = failedTypes[0];
3700        const failedPost = basePost.copy();
3701        failedPost.set.userList(UserList.from(basePost.userList.users.filter((user) => failedTypes.includes(user.type))));
3702        this.store.withPost(failedPost);
3703        this.store.withUserType(firstFailedType);
3704        this.personalizedService.loadTab(firstFailedType);
3705      }
3706    });
3707  }
3708  static \u0275fac = function MessengerFacade_Factory(__ngFactoryType__) {
3709    return new (__ngFactoryType__ || _MessengerFacade)();
3710  };
3711  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _MessengerFacade, factory: _MessengerFacade.\u0275fac, providedIn: "root" });
3712};
3713(() => {
3714  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MessengerFacade, [{
3715    type: Injectable,
3716    args: [{ providedIn: "root" }]
3717  }], null, null);
3718})();
3719
3720// libs/socialgest/messenger/src/presenter/components/scheduler/components/publisher/components/error-list/error-list.component.ts
3721var _c04 = ["menu"];
3722var _c12 = (a0) => ({ type: a0 });
3723function ErrorListComponent_ng_template_2_For_4_Conditional_1_Template(rf, ctx) {
3724  if (rf & 1) {
3725    \u0275\u0275element(0, "img", 5);
3726    \u0275\u0275pipe(1, "userIcon");
3727  }
3728  if (rf & 2) {
3729    const error_r1 = \u0275\u0275nextContext().$implicit;
3730    \u0275\u0275property("src", \u0275\u0275pipeBind1(1, 1, \u0275\u0275pureFunction1(3, _c12, error_r1.userType)), \u0275\u0275sanitizeUrl);
3731  }
3732}
3733function ErrorListComponent_ng_template_2_For_4_Conditional_2_Template(rf, ctx) {
3734  if (rf & 1) {
3735    \u0275\u0275element(0, "ui-icon", 6);
3736  }
3737}
3738function ErrorListComponent_ng_template_2_For_4_Template(rf, ctx) {
3739  if (rf & 1) {
3740    \u0275\u0275elementStart(0, "div", 4);
3741    \u0275\u0275conditionalCreate(1, ErrorListComponent_ng_template_2_For_4_Conditional_1_Template, 2, 5, "img", 5)(2, ErrorListComponent_ng_template_2_For_4_Conditional_2_Template, 1, 0, "ui-icon", 6);
3742    \u0275\u0275elementStart(3, "span", 7);
3743    \u0275\u0275text(4);
3744    \u0275\u0275pipe(5, "translate");
3745    \u0275\u0275elementEnd()();
3746  }
3747  if (rf & 2) {
3748    const error_r1 = ctx.$implicit;
3749    \u0275\u0275advance();
3750    \u0275\u0275conditional(error_r1.userType && error_r1.userType !== "all" ? 1 : 2);
3751    \u0275\u0275advance(3);
3752    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind2(5, 2, "POSTS.ERROR." + error_r1.code, error_r1.meta), " ");
3753  }
3754}
3755function ErrorListComponent_ng_template_2_Template(rf, ctx) {
3756  if (rf & 1) {
3757    \u0275\u0275elementStart(0, "h3", 3);
3758    \u0275\u0275text(1);
3759    \u0275\u0275pipe(2, "translate");
3760    \u0275\u0275elementEnd();
3761    \u0275\u0275repeaterCreate(3, ErrorListComponent_ng_template_2_For_4_Template, 6, 5, "div", 4, \u0275\u0275repeaterTrackByIndex);
3762  }
3763  if (rf & 2) {
3764    const ctx_r1 = \u0275\u0275nextContext();
3765    \u0275\u0275advance();
3766    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(2, 1, "MESSENGER.ERROR.NEED_ADJUSTMENTS"));
3767    \u0275\u0275advance(2);
3768    \u0275\u0275repeater(ctx_r1.errors());
3769  }
3770}
3771var ErrorListComponent = class _ErrorListComponent {
3772  errors = input.required();
3773  menu = viewChild.required("menu");
3774  show(event) {
3775    this.menu().show(event);
3776  }
3777  hide() {
3778    this.menu().hide();
3779  }
3780  static \u0275fac = function ErrorListComponent_Factory(__ngFactoryType__) {
3781    return new (__ngFactoryType__ || _ErrorListComponent)();
3782  };
3783  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _ErrorListComponent, selectors: [["app-error-list"]], viewQuery: function ErrorListComponent_Query(rf, ctx) {
3784    if (rf & 1) {
3785      \u0275\u0275viewQuerySignal(ctx.menu, _c04, 5);
3786    }
3787    if (rf & 2) {
3788      \u0275\u0275queryAdvance();
3789    }
3790  }, inputs: { errors: [1, "errors"] }, decls: 4, vars: 0, consts: [["menu", ""], ["item", ""], ["styleClass", "w-[23rem] -ml-7"], [1, "font-sans!", "font-semibold", "text-sm", "mb-4"], [1, "flex", "items-center", "gap-3", "my-3"], ["alt", "", 1, "size-4", "shrink-0", 3, "src"], ["name", "ban", "styleClass", "text-red-500 size-4 shrink-0"], [1, "font-sans!", "text-grey-500", "text-sm"]], template: function ErrorListComponent_Template(rf, ctx) {
3791    if (rf & 1) {
3792      \u0275\u0275elementStart(0, "ui-menu", 2, 0);
3793      \u0275\u0275template(2, ErrorListComponent_ng_template_2_Template, 5, 3, "ng-template", null, 1, \u0275\u0275templateRefExtractor);
3794      \u0275\u0275elementEnd();
3795    }
3796  }, dependencies: [CommonModule, TranslatePipe, MenuComponent, IconComponent, UserIconPipe], encapsulation: 2 });
3797};
3798(() => {
3799  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ErrorListComponent, [{
3800    type: Component,
3801    args: [{ selector: "app-error-list", imports: [CommonModule, TranslatePipe, MenuComponent, IconComponent, UserIconPipe], template: `<ui-menu #menu styleClass="w-[23rem] -ml-7">
3802  <ng-template #item>
3803    <h3 class="font-sans! font-semibold text-sm mb-4">{{ 'MESSENGER.ERROR.NEED_ADJUSTMENTS' | translate }}</h3>
3804
3805    @for(error of errors(); track $index){
3806    <div class="flex items-center gap-3 my-3">
3807      @if(error.userType && error.userType !== 'all') {
3808      <img [src]="{ type: error.userType } | userIcon" alt="" class="size-4 shrink-0" />
3809      } @else {
3810      <ui-icon name="ban" styleClass="text-red-500 size-4 shrink-0" />
3811      }
3812      <span class="font-sans! text-grey-500 text-sm">
3813        {{ 'POSTS.ERROR.' + error.code | translate : error.meta }}
3814      </span>
3815    </div>
3816    }
3817  </ng-template>
3818</ui-menu>
3819` }]
3820  }], null, null);
3821})();
3822(() => {
3823  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(ErrorListComponent, { className: "ErrorListComponent", filePath: "libs/socialgest/messenger/src/presenter/components/scheduler/components/publisher/components/error-list/error-list.component.ts", lineNumber: 11 });
3824})();
3825
vendor: 23,067 bytes, lines 3826-4523
3826// node_modules/canvas-confetti/dist/confetti.module.mjs
3827var module = {};
3828(function main(global, module2, isWorker, workerSize) {
3829  var canUseWorker = !!(global.Worker && global.Blob && global.Promise && global.OffscreenCanvas && global.OffscreenCanvasRenderingContext2D && global.HTMLCanvasElement && global.HTMLCanvasElement.prototype.transferControlToOffscreen && global.URL && global.URL.createObjectURL);
3830  var canUsePaths = typeof Path2D === "function" && typeof DOMMatrix === "function";
3831  var canDrawBitmap = (function() {
3832    if (!global.OffscreenCanvas) {
3833      return false;
3834    }
3835    try {
3836      var canvas = new OffscreenCanvas(1, 1);
3837      var ctx = canvas.getContext("2d");
3838      ctx.fillRect(0, 0, 1, 1);
3839      var bitmap = canvas.transferToImageBitmap();
3840      ctx.createPattern(bitmap, "no-repeat");
3841    } catch (e) {
3842      return false;
3843    }
3844    return true;
3845  })();
3846  function noop() {
3847  }
3848  function promise(func) {
3849    var ModulePromise = module2.exports.Promise;
3850    var Prom = ModulePromise !== void 0 ? ModulePromise : global.Promise;
3851    if (typeof Prom === "function") {
3852      return new Prom(func);
3853    }
3854    func(noop, noop);
3855    return null;
3856  }
3857  var bitmapMapper = /* @__PURE__ */ (function(skipTransform, map2) {
3858    return {
3859      transform: function(bitmap) {
3860        if (skipTransform) {
3861          return bitmap;
3862        }
3863        if (map2.has(bitmap)) {
3864          return map2.get(bitmap);
3865        }
3866        var canvas = new OffscreenCanvas(bitmap.width, bitmap.height);
3867        var ctx = canvas.getContext("2d");
3868        ctx.drawImage(bitmap, 0, 0);
3869        map2.set(bitmap, canvas);
3870        return canvas;
3871      },
3872      clear: function() {
3873        map2.clear();
3874      }
3875    };
3876  })(canDrawBitmap, /* @__PURE__ */ new Map());
3877  var raf = (function() {
3878    var TIME = Math.floor(1e3 / 60);
3879    var frame, cancel;
3880    var frames = {};
3881    var lastFrameTime = 0;
3882    if (typeof requestAnimationFrame === "function" && typeof cancelAnimationFrame === "function") {
3883      frame = function(cb) {
3884        var id = Math.random();
3885        frames[id] = requestAnimationFrame(function onFrame(time) {
3886          if (lastFrameTime === time || lastFrameTime + TIME - 1 < time) {
3887            lastFrameTime = time;
3888            delete frames[id];
3889            cb();
3890          } else {
3891            frames[id] = requestAnimationFrame(onFrame);
3892          }
3893        });
3894        return id;
3895      };
3896      cancel = function(id) {
3897        if (frames[id]) {
3898          cancelAnimationFrame(frames[id]);
3899        }
3900      };
3901    } else {
3902      frame = function(cb) {
3903        return setTimeout(cb, TIME);
3904      };
3905      cancel = function(timer) {
3906        return clearTimeout(timer);
3907      };
3908    }
3909    return { frame, cancel };
3910  })();
3911  var getWorker = /* @__PURE__ */ (function() {
3912    var worker;
3913    var prom;
3914    var resolves = {};
3915    function decorate(worker2) {
3916      function execute(options, callback) {
3917        worker2.postMessage({ options: options || {}, callback });
3918      }
3919      worker2.init = function initWorker(canvas) {
3920        var offscreen = canvas.transferControlToOffscreen();
3921        worker2.postMessage({ canvas: offscreen }, [offscreen]);
3922      };
3923      worker2.fire = function fireWorker(options, size, done) {
3924        if (prom) {
3925          execute(options, null);
3926          return prom;
3927        }
3928        var id = Math.random().toString(36).slice(2);
3929        prom = promise(function(resolve) {
3930          function workerDone(msg) {
3931            if (msg.data.callback !== id) {
3932              return;
3933            }
3934            delete resolves[id];
3935            worker2.removeEventListener("message", workerDone);
3936            prom = null;
3937            bitmapMapper.clear();
3938            done();
3939            resolve();
3940          }
3941          worker2.addEventListener("message", workerDone);
3942          execute(options, id);
3943          resolves[id] = workerDone.bind(null, { data: { callback: id } });
3944        });
3945        return prom;
3946      };
3947      worker2.reset = function resetWorker() {
3948        worker2.postMessage({ reset: true });
3949        for (var id in resolves) {
3950          resolves[id]();
3951          delete resolves[id];
3952        }
3953      };
3954    }
3955    return function() {
3956      if (worker) {
3957        return worker;
3958      }
3959      if (!isWorker && canUseWorker) {
3960        var code = [
3961          "var CONFETTI, SIZE = {}, module = {};",
3962          "(" + main.toString() + ")(this, module, true, SIZE);",
3963          "onmessage = function(msg) {",
3964          "  if (msg.data.options) {",
3965          "    CONFETTI(msg.data.options).then(function () {",
3966          "      if (msg.data.callback) {",
3967          "        postMessage({ callback: msg.data.callback });",
3968          "      }",
3969          "    });",
3970          "  } else if (msg.data.reset) {",
3971          "    CONFETTI && CONFETTI.reset();",
3972          "  } else if (msg.data.resize) {",
3973          "    SIZE.width = msg.data.resize.width;",
3974          "    SIZE.height = msg.data.resize.height;",
3975          "  } else if (msg.data.canvas) {",
3976          "    SIZE.width = msg.data.canvas.width;",
3977          "    SIZE.height = msg.data.canvas.height;",
3978          "    CONFETTI = module.exports.create(msg.data.canvas);",
3979          "  }",
3980          "}"
3981        ].join("\n");
3982        try {
3983          worker = new Worker(URL.createObjectURL(new Blob([code])));
3984        } catch (e) {
3985          typeof console !== "undefined" && typeof console.warn === "function" ? console.warn("\u{1F38A} Could not load worker", e) : null;
3986          return null;
3987        }
3988        decorate(worker);
3989      }
3990      return worker;
3991    };
3992  })();
3993  var defaults = {
3994    particleCount: 50,
3995    angle: 90,
3996    spread: 45,
3997    startVelocity: 45,
3998    decay: 0.9,
3999    gravity: 1,
4000    drift: 0,
4001    ticks: 200,
4002    x: 0.5,
4003    y: 0.5,
4004    shapes: ["square", "circle"],
4005    zIndex: 100,
4006    colors: [
4007      "#26ccff",
4008      "#a25afd",
4009      "#ff5e7e",
4010      "#88ff5a",
4011      "#fcff42",
4012      "#ffa62d",
4013      "#ff36ff"
4014    ],
4015    // probably should be true, but back-compat
4016    disableForReducedMotion: false,
4017    scalar: 1
4018  };
4019  function convert2(val, transform) {
4020    return transform ? transform(val) : val;
4021  }
4022  function isOk(val) {
4023    return !(val === null || val === void 0);
4024  }
4025  function prop(options, name, transform) {
4026    return convert2(
4027      options && isOk(options[name]) ? options[name] : defaults[name],
4028      transform
4029    );
4030  }
4031  function onlyPositiveInt(number) {
4032    return number < 0 ? 0 : Math.floor(number);
4033  }
4034  function randomInt(min, max) {
4035    return Math.floor(Math.random() * (max - min)) + min;
4036  }
4037  function toDecimal(str) {
4038    return parseInt(str, 16);
4039  }
4040  function colorsToRgb(colors) {
4041    return colors.map(hexToRgb);
4042  }
4043  function hexToRgb(str) {
4044    var val = String(str).replace(/[^0-9a-f]/gi, "");
4045    if (val.length < 6) {
4046      val = val[0] + val[0] + val[1] + val[1] + val[2] + val[2];
4047    }
4048    return {
4049      r: toDecimal(val.substring(0, 2)),
4050      g: toDecimal(val.substring(2, 4)),
4051      b: toDecimal(val.substring(4, 6))
4052    };
4053  }
4054  function getOrigin(options) {
4055    var origin = prop(options, "origin", Object);
4056    origin.x = prop(origin, "x", Number);
4057    origin.y = prop(origin, "y", Number);
4058    return origin;
4059  }
4060  function setCanvasWindowSize(canvas) {
4061    canvas.width = document.documentElement.clientWidth;
4062    canvas.height = document.documentElement.clientHeight;
4063  }
4064  function setCanvasRectSize(canvas) {
4065    var rect = canvas.getBoundingClientRect();
4066    canvas.width = rect.width;
4067    canvas.height = rect.height;
4068  }
4069  function getCanvas(zIndex) {
4070    var canvas = document.createElement("canvas");
4071    canvas.style.position = "fixed";
4072    canvas.style.top = "0px";
4073    canvas.style.left = "0px";
4074    canvas.style.pointerEvents = "none";
4075    canvas.style.zIndex = zIndex;
4076    return canvas;
4077  }
4078  function ellipse(context, x, y, radiusX, radiusY, rotation, startAngle, endAngle, antiClockwise) {
4079    context.save();
4080    context.translate(x, y);
4081    context.rotate(rotation);
4082    context.scale(radiusX, radiusY);
4083    context.arc(0, 0, 1, startAngle, endAngle, antiClockwise);
4084    context.restore();
4085  }
4086  function randomPhysics(opts) {
4087    var radAngle = opts.angle * (Math.PI / 180);
4088    var radSpread = opts.spread * (Math.PI / 180);
4089    return {
4090      x: opts.x,
4091      y: opts.y,
4092      wobble: Math.random() * 10,
4093      wobbleSpeed: Math.min(0.11, Math.random() * 0.1 + 0.05),
4094      velocity: opts.startVelocity * 0.5 + Math.random() * opts.startVelocity,
4095      angle2D: -radAngle + (0.5 * radSpread - Math.random() * radSpread),
4096      tiltAngle: (Math.random() * (0.75 - 0.25) + 0.25) * Math.PI,
4097      color: opts.color,
4098      shape: opts.shape,
4099      tick: 0,
4100      totalTicks: opts.ticks,
4101      decay: opts.decay,
4102      drift: opts.drift,
4103      random: Math.random() + 2,
4104      tiltSin: 0,
4105      tiltCos: 0,
4106      wobbleX: 0,
4107      wobbleY: 0,
4108      gravity: opts.gravity * 3,
4109      ovalScalar: 0.6,
4110      scalar: opts.scalar,
4111      flat: opts.flat
4112    };
4113  }
4114  function updateFetti(context, fetti) {
4115    fetti.x += Math.cos(fetti.angle2D) * fetti.velocity + fetti.drift;
4116    fetti.y += Math.sin(fetti.angle2D) * fetti.velocity + fetti.gravity;
4117    fetti.velocity *= fetti.decay;
4118    if (fetti.flat) {
4119      fetti.wobble = 0;
4120      fetti.wobbleX = fetti.x + 10 * fetti.scalar;
4121      fetti.wobbleY = fetti.y + 10 * fetti.scalar;
4122      fetti.tiltSin = 0;
4123      fetti.tiltCos = 0;
4124      fetti.random = 1;
4125    } else {
4126      fetti.wobble += fetti.wobbleSpeed;
4127      fetti.wobbleX = fetti.x + 10 * fetti.scalar * Math.cos(fetti.wobble);
4128      fetti.wobbleY = fetti.y + 10 * fetti.scalar * Math.sin(fetti.wobble);
4129      fetti.tiltAngle += 0.1;
4130      fetti.tiltSin = Math.sin(fetti.tiltAngle);
4131      fetti.tiltCos = Math.cos(fetti.tiltAngle);
4132      fetti.random = Math.random() + 2;
4133    }
4134    var progress = fetti.tick++ / fetti.totalTicks;
4135    var x1 = fetti.x + fetti.random * fetti.tiltCos;
4136    var y1 = fetti.y + fetti.random * fetti.tiltSin;
4137    var x2 = fetti.wobbleX + fetti.random * fetti.tiltCos;
4138    var y2 = fetti.wobbleY + fetti.random * fetti.tiltSin;
4139    context.fillStyle = "rgba(" + fetti.color.r + ", " + fetti.color.g + ", " + fetti.color.b + ", " + (1 - progress) + ")";
4140    context.beginPath();
4141    if (canUsePaths && fetti.shape.type === "path" && typeof fetti.shape.path === "string" && Array.isArray(fetti.shape.matrix)) {
4142      context.fill(transformPath2D(
4143        fetti.shape.path,
4144        fetti.shape.matrix,
4145        fetti.x,
4146        fetti.y,
4147        Math.abs(x2 - x1) * 0.1,
4148        Math.abs(y2 - y1) * 0.1,
4149        Math.PI / 10 * fetti.wobble
4150      ));
4151    } else if (fetti.shape.type === "bitmap") {
4152      var rotation = Math.PI / 10 * fetti.wobble;
4153      var scaleX = Math.abs(x2 - x1) * 0.1;
4154      var scaleY = Math.abs(y2 - y1) * 0.1;
4155      var width = fetti.shape.bitmap.width * fetti.scalar;
4156      var height = fetti.shape.bitmap.height * fetti.scalar;
4157      var matrix = new DOMMatrix([
4158        Math.cos(rotation) * scaleX,
4159        Math.sin(rotation) * scaleX,
4160        -Math.sin(rotation) * scaleY,
4161        Math.cos(rotation) * scaleY,
4162        fetti.x,
4163        fetti.y
4164      ]);
4165      matrix.multiplySelf(new DOMMatrix(fetti.shape.matrix));
4166      var pattern = context.createPattern(bitmapMapper.transform(fetti.shape.bitmap), "no-repeat");
4167      pattern.setTransform(matrix);
4168      context.globalAlpha = 1 - progress;
4169      context.fillStyle = pattern;
4170      context.fillRect(
4171        fetti.x - width / 2,
4172        fetti.y - height / 2,
4173        width,
4174        height
4175      );
4176      context.globalAlpha = 1;
4177    } else if (fetti.shape === "circle") {
4178      context.ellipse ? context.ellipse(fetti.x, fetti.y, Math.abs(x2 - x1) * fetti.ovalScalar, Math.abs(y2 - y1) * fetti.ovalScalar, Math.PI / 10 * fetti.wobble, 0, 2 * Math.PI) : ellipse(context, fetti.x, fetti.y, Math.abs(x2 - x1) * fetti.ovalScalar, Math.abs(y2 - y1) * fetti.ovalScalar, Math.PI / 10 * fetti.wobble, 0, 2 * Math.PI);
4179    } else if (fetti.shape === "star") {
4180      var rot = Math.PI / 2 * 3;
4181      var innerRadius = 4 * fetti.scalar;
4182      var outerRadius = 8 * fetti.scalar;
4183      var x = fetti.x;
4184      var y = fetti.y;
4185      var spikes = 5;
4186      var step = Math.PI / spikes;
4187      while (spikes--) {
4188        x = fetti.x + Math.cos(rot) * outerRadius;
4189        y = fetti.y + Math.sin(rot) * outerRadius;
4190        context.lineTo(x, y);
4191        rot += step;
4192        x = fetti.x + Math.cos(rot) * innerRadius;
4193        y = fetti.y + Math.sin(rot) * innerRadius;
4194        context.lineTo(x, y);
4195        rot += step;
4196      }
4197    } else {
4198      context.moveTo(Math.floor(fetti.x), Math.floor(fetti.y));
4199      context.lineTo(Math.floor(fetti.wobbleX), Math.floor(y1));
4200      context.lineTo(Math.floor(x2), Math.floor(y2));
4201      context.lineTo(Math.floor(x1), Math.floor(fetti.wobbleY));
4202    }
4203    context.closePath();
4204    context.fill();
4205    return fetti.tick < fetti.totalTicks;
4206  }
4207  function animate(canvas, fettis, resizer, size, done) {
4208    var animatingFettis = fettis.slice();
4209    var context = canvas.getContext("2d");
4210    var animationFrame;
4211    var destroy;
4212    var prom = promise(function(resolve) {
4213      function onDone() {
4214        animationFrame = destroy = null;
4215        context.clearRect(0, 0, size.width, size.height);
4216        bitmapMapper.clear();
4217        done();
4218        resolve();
4219      }
4220      function update() {
4221        if (isWorker && !(size.width === workerSize.width && size.height === workerSize.height)) {
4222          size.width = canvas.width = workerSize.width;
4223          size.height = canvas.height = workerSize.height;
4224        }
4225        if (!size.width && !size.height) {
4226          resizer(canvas);
4227          size.width = canvas.width;
4228          size.height = canvas.height;
4229        }
4230        context.clearRect(0, 0, size.width, size.height);
4231        animatingFettis = animatingFettis.filter(function(fetti) {
4232          return updateFetti(context, fetti);
4233        });
4234        if (animatingFettis.length) {
4235          animationFrame = raf.frame(update);
4236        } else {
4237          onDone();
4238        }
4239      }
4240      animationFrame = raf.frame(update);
4241      destroy = onDone;
4242    });
4243    return {
4244      addFettis: function(fettis2) {
4245        animatingFettis = animatingFettis.concat(fettis2);
4246        return prom;
4247      },
4248      canvas,
4249      promise: prom,
4250      reset: function() {
4251        if (animationFrame) {
4252          raf.cancel(animationFrame);
4253        }
4254        if (destroy) {
4255          destroy();
4256        }
4257      }
4258    };
4259  }
4260  function confettiCannon(canvas, globalOpts) {
4261    var isLibCanvas = !canvas;
4262    var allowResize = !!prop(globalOpts || {}, "resize");
4263    var hasResizeEventRegistered = false;
4264    var globalDisableForReducedMotion = prop(globalOpts, "disableForReducedMotion", Boolean);
4265    var shouldUseWorker = canUseWorker && !!prop(globalOpts || {}, "useWorker");
4266    var worker = shouldUseWorker ? getWorker() : null;
4267    var resizer = isLibCanvas ? setCanvasWindowSize : setCanvasRectSize;
4268    var initialized = canvas && worker ? !!canvas.__confetti_initialized : false;
4269    var preferLessMotion = typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion)").matches;
4270    var animationObj;
4271    function fireLocal(options, size, done) {
4272      var particleCount = prop(options, "particleCount", onlyPositiveInt);
4273      var angle = prop(options, "angle", Number);
4274      var spread = prop(options, "spread", Number);
4275      var startVelocity = prop(options, "startVelocity", Number);
4276      var decay = prop(options, "decay", Number);
4277      var gravity = prop(options, "gravity", Number);
4278      var drift = prop(options, "drift", Number);
4279      var colors = prop(options, "colors", colorsToRgb);
4280      var ticks = prop(options, "ticks", Number);
4281      var shapes = prop(options, "shapes");
4282      var scalar = prop(options, "scalar");
4283      var flat = !!prop(options, "flat");
4284      var origin = getOrigin(options);
4285      var temp = particleCount;
4286      var fettis = [];
4287      var startX = canvas.width * origin.x;
4288      var startY = canvas.height * origin.y;
4289      while (temp--) {
4290        fettis.push(
4291          randomPhysics({
4292            x: startX,
4293            y: startY,
4294            angle,
4295            spread,
4296            startVelocity,
4297            color: colors[temp % colors.length],
4298            shape: shapes[randomInt(0, shapes.length)],
4299            ticks,
4300            decay,
4301            gravity,
4302            drift,
4303            scalar,
4304            flat
4305          })
4306        );
4307      }
4308      if (animationObj) {
4309        return animationObj.addFettis(fettis);
4310      }
4311      animationObj = animate(canvas, fettis, resizer, size, done);
4312      return animationObj.promise;
4313    }
4314    function fire(options) {
4315      var disableForReducedMotion = globalDisableForReducedMotion || prop(options, "disableForReducedMotion", Boolean);
4316      var zIndex = prop(options, "zIndex", Number);
4317      if (disableForReducedMotion && preferLessMotion) {
4318        return promise(function(resolve) {
4319          resolve();
4320        });
4321      }
4322      if (isLibCanvas && animationObj) {
4323        canvas = animationObj.canvas;
4324      } else if (isLibCanvas && !canvas) {
4325        canvas = getCanvas(zIndex);
4326        document.body.appendChild(canvas);
4327      }
4328      if (allowResize && !initialized) {
4329        resizer(canvas);
4330      }
4331      var size = {
4332        width: canvas.width,
4333        height: canvas.height
4334      };
4335      if (worker && !initialized) {
4336        worker.init(canvas);
4337      }
4338      initialized = true;
4339      if (worker) {
4340        canvas.__confetti_initialized = true;
4341      }
4342      function onResize() {
4343        if (worker) {
4344          var obj = {
4345            getBoundingClientRect: function() {
4346              if (!isLibCanvas) {
4347                return canvas.getBoundingClientRect();
4348              }
4349            }
4350          };
4351          resizer(obj);
4352          worker.postMessage({
4353            resize: {
4354              width: obj.width,
4355              height: obj.height
4356            }
4357          });
4358          return;
4359        }
4360        size.width = size.height = null;
4361      }
4362      function done() {
4363        animationObj = null;
4364        if (allowResize) {
4365          hasResizeEventRegistered = false;
4366          global.removeEventListener("resize", onResize);
4367        }
4368        if (isLibCanvas && canvas) {
4369          if (document.body.contains(canvas)) {
4370            document.body.removeChild(canvas);
4371          }
4372          canvas = null;
4373          initialized = false;
4374        }
4375      }
4376      if (allowResize && !hasResizeEventRegistered) {
4377        hasResizeEventRegistered = true;
4378        global.addEventListener("resize", onResize, false);
4379      }
4380      if (worker) {
4381        return worker.fire(options, size, done);
4382      }
4383      return fireLocal(options, size, done);
4384    }
4385    fire.reset = function() {
4386      if (worker) {
4387        worker.reset();
4388      }
4389      if (animationObj) {
4390        animationObj.reset();
4391      }
4392    };
4393    return fire;
4394  }
4395  var defaultFire;
4396  function getDefaultFire() {
4397    if (!defaultFire) {
4398      defaultFire = confettiCannon(null, { useWorker: true, resize: true });
4399    }
4400    return defaultFire;
4401  }
4402  function transformPath2D(pathString, pathMatrix, x, y, scaleX, scaleY, rotation) {
4403    var path2d = new Path2D(pathString);
4404    var t1 = new Path2D();
4405    t1.addPath(path2d, new DOMMatrix(pathMatrix));
4406    var t2 = new Path2D();
4407    t2.addPath(t1, new DOMMatrix([
4408      Math.cos(rotation) * scaleX,
4409      Math.sin(rotation) * scaleX,
4410      -Math.sin(rotation) * scaleY,
4411      Math.cos(rotation) * scaleY,
4412      x,
4413      y
4414    ]));
4415    return t2;
4416  }
4417  function shapeFromPath(pathData) {
4418    if (!canUsePaths) {
4419      throw new Error("path confetti are not supported in this browser");
4420    }
4421    var path, matrix;
4422    if (typeof pathData === "string") {
4423      path = pathData;
4424    } else {
4425      path = pathData.path;
4426      matrix = pathData.matrix;
4427    }
4428    var path2d = new Path2D(path);
4429    var tempCanvas = document.createElement("canvas");
4430    var tempCtx = tempCanvas.getContext("2d");
4431    if (!matrix) {
4432      var maxSize = 1e3;
4433      var minX = maxSize;
4434      var minY = maxSize;
4435      var maxX = 0;
4436      var maxY = 0;
4437      var width, height;
4438      for (var x = 0; x < maxSize; x += 2) {
4439        for (var y = 0; y < maxSize; y += 2) {
4440          if (tempCtx.isPointInPath(path2d, x, y, "nonzero")) {
4441            minX = Math.min(minX, x);
4442            minY = Math.min(minY, y);
4443            maxX = Math.max(maxX, x);
4444            maxY = Math.max(maxY, y);
4445          }
4446        }
4447      }
4448      width = maxX - minX;
4449      height = maxY - minY;
4450      var maxDesiredSize = 10;
4451      var scale = Math.min(maxDesiredSize / width, maxDesiredSize / height);
4452      matrix = [
4453        scale,
4454        0,
4455        0,
4456        scale,
4457        -Math.round(width / 2 + minX) * scale,
4458        -Math.round(height / 2 + minY) * scale
4459      ];
4460    }
4461    return {
4462      type: "path",
4463      path,
4464      matrix
4465    };
4466  }
4467  function shapeFromText(textData) {
4468    var text, scalar = 1, color = "#000000", fontFamily = '"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';
4469    if (typeof textData === "string") {
4470      text = textData;
4471    } else {
4472      text = textData.text;
4473      scalar = "scalar" in textData ? textData.scalar : scalar;
4474      fontFamily = "fontFamily" in textData ? textData.fontFamily : fontFamily;
4475      color = "color" in textData ? textData.color : color;
4476    }
4477    var fontSize = 10 * scalar;
4478    var font = "" + fontSize + "px " + fontFamily;
4479    var canvas = new OffscreenCanvas(fontSize, fontSize);
4480    var ctx = canvas.getContext("2d");
4481    ctx.font = font;
4482    var size = ctx.measureText(text);
4483    var width = Math.ceil(size.actualBoundingBoxRight + size.actualBoundingBoxLeft);
4484    var height = Math.ceil(size.actualBoundingBoxAscent + size.actualBoundingBoxDescent);
4485    var padding = 2;
4486    var x = size.actualBoundingBoxLeft + padding;
4487    var y = size.actualBoundingBoxAscent + padding;
4488    width += padding + padding;
4489    height += padding + padding;
4490    canvas = new OffscreenCanvas(width, height);
4491    ctx = canvas.getContext("2d");
4492    ctx.font = font;
4493    ctx.fillStyle = color;
4494    ctx.fillText(text, x, y);
4495    var scale = 1 / scalar;
4496    return {
4497      type: "bitmap",
4498      // TODO these probably need to be transfered for workers
4499      bitmap: canvas.transferToImageBitmap(),
4500      matrix: [scale, 0, 0, scale, -width * scale / 2, -height * scale / 2]
4501    };
4502  }
4503  module2.exports = function() {
4504    return getDefaultFire().apply(this, arguments);
4505  };
4506  module2.exports.reset = function() {
4507    getDefaultFire().reset();
4508  };
4509  module2.exports.create = confettiCannon;
4510  module2.exports.shapeFromPath = shapeFromPath;
4511  module2.exports.shapeFromText = shapeFromText;
4512})((function() {
4513  if (typeof window !== "undefined") {
4514    return window;
4515  }
4516  if (typeof self !== "undefined") {
4517    return self;
4518  }
4519  return this || {};
4520})(), module, false);
4521var confetti_module_default = module.exports;
4522var create = module.exports.create;
4523
4524// libs/socialgest/messenger/src/presenter/components/scheduler/components/publisher/components/publication-success/publication-success.component.ts
4525var PublicationSuccessComponent = class _PublicationSuccessComponent {
4526  label = input.required();
4527  el = inject(ElementRef);
4528  ngOnInit() {
4529    const rect = this.el.nativeElement.getBoundingClientRect();
4530    const x = (rect.left + rect.width / 2) / window.innerWidth;
4531    const y = (rect.top + rect.height / 2) / window.innerHeight;
4532    const canvas = document.createElement("canvas");
4533    canvas.style.cssText = "position:fixed;inset:0;width:100%;height:100%;pointer-events:none;z-index:99999;";
4534    document.body.appendChild(canvas);
4535    const fire = confetti_module_default.create(canvas, { resize: true });
4536    fire({ particleCount: 140, spread: 80, origin: { x, y } });
4537    setTimeout(() => canvas.remove(), 4e3);
4538  }
4539  static \u0275fac = function PublicationSuccessComponent_Factory(__ngFactoryType__) {
4540    return new (__ngFactoryType__ || _PublicationSuccessComponent)();
4541  };
4542  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _PublicationSuccessComponent, selectors: [["app-publication-success"]], inputs: { label: [1, "label"] }, decls: 14, vars: 3, consts: [[1, "flex", "items-center", "justify-start", "gap-3", "w-full", "h-[3.05rem]", "px-6", "rounded-lg", "cursor-default", "select-none", "bg-primary", "text-primary-contrast"], ["viewBox", "0 0 27 27", "fill", "none", "xmlns", "http://www.w3.org/2000/svg", 1, "success-svg"], ["d", "M5.58594 12.457L0.835938 25.832L14.2109 21.0945", 1, "sp", "sp-tri"], ["d", "M3.33594 2.08203H3.34844", 1, "sp-dot", "sp-d1"], ["d", "M25.8359 8.33203H25.8484", 
45421, "sp-dot", "sp-d2"], ["d", "M17.0859 0.832031H17.0984", 1, "sp-dot", "sp-d3"], ["d", "M25.8359 23.332H25.8484", 1, "sp-dot", "sp-d4"], ["d", "M25.8359 0.832031L23.0359 1.76953C22.2389 2.03502 21.5588 2.56908 21.112 3.28044C20.6651 3.99179 20.4792 4.83627 20.5859 5.66953C20.7109 6.74453 19.8734 7.70703 18.7734 7.70703H18.2984C17.2234 7.70703 16.2984 8.45703 16.0984 9.50703L15.8359 10.832", 1, "sp", "sp-main"], ["d", "M25.8359 14.582L24.8109 14.1695C23.7359 13.7445 22.5359 14.4195 22.3359 15.557C22.1984 16.432 21.4359 17.082 20.5484 17.082H19.5859", 1, "sp", "sp-arm1"], ["d", "M12.0859 0.832031L12.4984 1.85703C12.9234 2.93203 12.2484 4.13203 11.1109 4.33203C10.2359 4.45703 9.58594 5.23203 9.58594 6.11953V7.08203", 1, "sp", "sp-arm2"], ["d", "M12.0859 14.582C14.4984 16.9945 15.6234 19.7945 14.5859 20.832C13.5484 21.8695 10.7484 20.7445 8.33594 18.332C5.92344 15.9195 4.79844 13.1195 5.83594 12.082C6.87344 11.0445 9.67344 12.1695 12.0859 14.582Z", 1, "sp", "sp-swrl"], [1, "text-white", "text-sm", "font-semibold"]], template: function PublicationSuccessComponent_Template(rf, ctx) {
4543    if (rf & 1) {
4544      \u0275\u0275elementStart(0, "div", 0);
4545      \u0275\u0275namespaceSVG();
4546      \u0275\u0275elementStart(1, "svg", 1);
4547      \u0275\u0275element(2, "path", 2)(3, "path", 3)(4, "path", 4)(5, "path", 5)(6, "path", 6)(7, "path", 7)(8, "path", 8)(9, "path", 9)(10, "path", 10);
4548      \u0275\u0275elementEnd();
4549      \u0275\u0275namespaceHTML();
4550      \u0275\u0275elementStart(11, "span", 11);
4551      \u0275\u0275text(12);
4552      \u0275\u0275pipe(13, "translate");
4553      \u0275\u0275elementEnd()();
4554    }
4555    if (rf & 2) {
4556      \u0275\u0275advance(12);
4557      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(13, 1, ctx.label()));
4558    }
4559  }, dependencies: [TranslatePipe], styles: ["\n\n@keyframes _ngcontent-%COMP%_draw {\n  to {\n    stroke-dashoffset: 0;\n  }\n}\n@keyframes _ngcontent-%COMP%_glow-pulse {\n  0%, 100% {\n    filter: drop-shadow(0 0 0.3125rem rgba(255, 255, 255, 0.4));\n  }\n  50% {\n    filter: drop-shadow(0 0 0.625rem rgba(255, 255, 255, 0.75));\n  }\n}\n@keyframes _ngcontent-%COMP%_float-icon {\n  0%, 100% {\n    transform: translateY(0);\n  }\n  45% {\n    transform: translateY(-0.25rem);\n  }\n}\n.success-svg[_ngcontent-%COMP%] {\n  width: 1.5rem;\n  height: 1.5rem;\n  overflow: visible;\n  flex-shrink: 0;\n  animation: _ngcontent-%COMP%_glow-pulse 3s ease-in-out infinite, _ngcontent-%COMP%_float-icon 4s ease-in-out infinite;\n}\n.sp[_ngcontent-%COMP%] {\n  fill: none;\n  stroke: currentColor;\n  stroke-width: 1.66667;\n  stroke-linecap: round;\n  stroke-linejoin: round;\n  stroke-dasharray: 150;\n  stroke-dashoffset: 150;\n}\n.sp-tri[_ngcontent-%COMP%] {\n  animation: _ngcontent-%COMP%_draw 0.32s 0.65s cubic-bezier(0.2, 0, 0.3, 1) forwards;\n}\n.sp-main[_ngcontent-%COMP%] {\n  animation: _ngcontent-%COMP%_draw 0.68s 0.26s cubic-bezier(0.25, 0, 0.35, 1) forwards;\n}\n.sp-arm1[_ngcontent-%COMP%] {\n  animation: _ngcontent-%COMP%_draw 0.42s 0.56s ease forwards;\n}\n.sp-arm2[_ngcontent-%COMP%] {\n  animation: _ngcontent-%COMP%_draw 0.42s 0.52s ease forwards;\n}\n.sp-swrl[_ngcontent-%COMP%] {\n  animation: _ngcontent-%COMP%_draw 0.56s 0.76s cubic-bezier(0.4, 0, 0.1, 1) forwards;\n}\n.sp-dot[_ngcontent-%COMP%] {\n  fill: none;\n  stroke: currentColor;\n  stroke-width: 1.66667;\n  stroke-linecap: round;\n  opacity: 0;\n}\n@keyframes _ngcontent-%COMP%_twinkle {\n  0%, 100% {\n    opacity: 0.15;\n  }\n  50% {\n    opacity: 1;\n  }\n}\n.sp-d1[_ngcontent-%COMP%] {\n  animation: _ngcontent-%COMP%_twinkle 1.65s 0.94s ease-in-out infinite;\n}\n.sp-d2[_ngcontent-%COMP%] {\n  animation: _ngcontent-%COMP%_twinkle 2.1s 1.34s ease-in-out infinite;\n}\n.sp-d3[_ngcontent-%COMP%] {\n  animation: _ngcontent-%COMP%_twinkle 1.45s 1.7s ease-in-out infinite;\n}\n.sp-d4[_ngcontent-%COMP%] {\n  animation: _ngcontent-%COMP%_twinkle 2.3s 2.06s ease-in-out infinite;\n}"] });
4560};
4561(() => {
4562  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PublicationSuccessComponent, [{
4563    type: Component,
4564    args: [{ selector: "app-publication-success", imports: [TranslatePipe], template: '<div\n  class="flex items-center justify-start gap-3 w-full h-[3.05rem] px-6 rounded-lg cursor-default select-none bg-primary text-primary-contrast"\n>\n  <svg class="success-svg" viewBox="0 0 27 27" fill="none" xmlns="http://www.w3.org/2000/svg">\n    <path class="sp sp-tri" d="M5.58594 12.457L0.835938 25.832L14.2109 21.0945" />\n    <path class="sp-dot sp-d1" d="M3.33594 2.08203H3.34844" />\n    <path class="sp-dot sp-d2" d="M25.8359 8.33203H25.8484" />\n    <path class="sp-dot sp-d3" d="M17.0859 0.832031H17.0984" />\n    <path class="sp-dot sp-d4" d="M25.8359 23.332H25.8484" />\n    <path\n      class="sp sp-main"\n      d="M25.8359 0.832031L23.0359 1.76953C22.2389 2.03502 21.5588 2.56908 21.112 3.28044C20.6651 3.99179 20.4792 4.83627 20.5859 5.66953C20.7109 6.74453 19.8734 7.70703 18.7734 7.70703H18.2984C17.2234 7.70703 16.2984 8.45703 16.0984 9.50703L15.8359 10.832"\n    />\n    <path\n      class="sp sp-arm1"\n      d="M25.8359 14.582L24.8109 14.1695C23.7359 13.7445 22.5359 14.4195 22.3359 15.557C22.1984 16.432 21.4359 17.082 20.5484 17.082H19.5859"\n    />\n    <path\n      class="sp sp-arm2"\n      d="M12.0859 0.832031L12.4984 1.85703C12.9234 2.93203 12.2484 4.13203 11.1109 4.33203C10.2359 4.45703 9.58594 5.23203 9.58594 6.11953V7.08203"\n    />\n    <path\n      class="sp sp-swrl"\n      d="M12.0859 14.582C14.4984 16.9945 15.6234 19.7945 14.5859 20.832C13.5484 21.8695 10.7484 20.7445 8.33594 18.332C5.92344 15.9195 4.79844 13.1195 5.83594 12.082C6.87344 11.0445 9.67344 12.1695 12.0859 14.582Z"\n    />\n  </svg>\n  <span class="text-white text-sm font-semibold">{{ label() | translate }}</span>\n</div>\n', styles: ["/* angular:styles/component:css;
45646b2eda2ec14c0157660abe0968770c722eaad970607aa2960819f56164272694;/codebuild/output/src3806768626/src/libs/socialgest/messenger/src/presenter/components/scheduler/components/publisher/components/publication-success/publication-success.component.ts */\n@keyframes draw {\n  to {\n    stroke-dashoffset: 0;\n  }\n}\n@keyframes glow-pulse {\n  0%, 100% {\n    filter: drop-shadow(0 0 0.3125rem rgba(255, 255, 255, 0.4));\n  }\n  50% {\n    filter: drop-shadow(0 0 0.625rem rgba(255, 255, 255, 0.75));\n  }\n}\n@keyframes float-icon {\n  0%, 100% {\n    transform: translateY(0);\n  }\n  45% {\n    transform: translateY(-0.25rem);\n  }\n}\n.success-svg {\n  width: 1.5rem;\n  height: 1.5rem;\n  overflow: visible;\n  flex-shrink: 0;\n  animation: glow-pulse 3s ease-in-out infinite, float-icon 4s ease-in-out infinite;\n}\n.sp {\n  fill: none;\n  stroke: currentColor;\n  stroke-width: 1.66667;\n  stroke-linecap: round;\n  stroke-linejoin: round;\n  stroke-dasharray: 150;\n  stroke-dashoffset: 150;\n}\n.sp-tri {\n  animation: draw 0.32s 0.65s cubic-bezier(0.2, 0, 0.3, 1) forwards;\n}\n.sp-main {\n  animation: draw 0.68s 0.26s cubic-bezier(0.25, 0, 0.35, 1) forwards;\n}\n.sp-arm1 {\n  animation: draw 0.42s 0.56s ease forwards;\n}\n.sp-arm2 {\n  animation: draw 0.42s 0.52s ease forwards;\n}\n.sp-swrl {\n  animation: draw 0.56s 0.76s cubic-bezier(0.4, 0, 0.1, 1) forwards;\n}\n.sp-dot {\n  fill: none;\n  stroke: currentColor;\n  stroke-width: 1.66667;\n  stroke-linecap: round;\n  opacity: 0;\n}\n@keyframes twinkle {\n  0%, 100% {\n    opacity: 0.15;\n  }\n  50% {\n    opacity: 1;\n  }\n}\n.sp-d1 {\n  animation: twinkle 1.65s 0.94s ease-in-out infinite;\n}\n.sp-d2 {\n  animation: twinkle 2.1s 1.34s ease-in-out infinite;\n}\n.sp-d3 {\n  animation: twinkle 1.45s 1.7s ease-in-out infinite;\n}\n.sp-d4 {\n  animation: twinkle 2.3s 2.06s ease-in-out infinite;\n}\n"] }]
4565  }], null, null);
4566})();
4567(() => {
4568  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(PublicationSuccessComponent, { className: "PublicationSuccessComponent", filePath: "libs/socialgest/messenger/src/presenter/components/scheduler/components/publisher/components/publication-success/publication-success.component.ts", lineNumber: 96 });
4569})();
4570
4571// libs/socialgest/messenger/src/presenter/components/scheduler/components/publisher/publisher.component.ts
4572var _c05 = (a0) => ({ "pointer-events-none": a0 });
4573var _c13 = (a0) => ({ hidden: a0 });
4574function PublisherComponent_Conditional_3_Template(rf, ctx) {
4575  if (rf & 1) {
4576    \u0275\u0275elementStart(0, "div", 3);
4577    \u0275\u0275element(1, "app-publication-success", 4);
4578    \u0275\u0275elementEnd();
4579  }
4580  if (rf & 2) {
4581    const ctx_r0 = \u0275\u0275nextContext();
4582    \u0275\u0275advance();
4583    \u0275\u0275property("label", ctx_r0.successLabel());
4584  }
4585}
4586function PublisherComponent_Conditional_4_Conditional_1_Template(rf, ctx) {
4587  if (rf & 1) {
4588    const _r3 = \u0275\u0275getCurrentView();
4589    \u0275\u0275elementStart(0, "ui-button", 14);
4590    \u0275\u0275pipe(1, "translate");
4591    \u0275\u0275listener("click", function PublisherComponent_Conditional_4_Conditional_1_Template_ui_button_click_0_listener() {
4592      \u0275\u0275restoreView(_r3);
4593      const ctx_r0 = \u0275\u0275nextContext(2);
4594      return \u0275\u0275resetView(ctx_r0.executeAction("sendToApproval"));
4595    });
4596    \u0275\u0275elementEnd();
4597  }
4598  if (rf & 2) {
4599    const ctx_r0 = \u0275\u0275nextContext(2);
4600    const isLoading_r4 = \u0275\u0275readContextLet(0);
4601    \u0275\u0275property("isLoading", isLoading_r4)("tooltip", \u0275\u0275pipeBind1(1, 6, "POSTS.APPROVE"))("tooltipPosition", "top")("hidden", ctx_r0.errors().length)("disabled", isLoading_r4)("ngClass", \u0275\u0275pureFunction1(8, _c05, isLoading_r4));
4602  }
4603}
4604function PublisherComponent_Conditional_4_Conditional_3_Template(rf, ctx) {
4605  if (rf & 1) {
4606    const _r6 = \u0275\u0275getCurrentView();
4607    \u0275\u0275elementStart(0, "ui-button", 15);
4608    \u0275\u0275listener("click", function PublisherComponent_Conditional_4_Conditional_3_Template_ui_button_click_0_listener() {
4609      \u0275\u0275restoreView(_r6);
4610      const ctx_r0 = \u0275\u0275nextContext(2);
4611      return \u0275\u0275resetView(ctx_r0.executeMainAction());
4612    });
4613    \u0275\u0275elementEnd();
4614  }
4615  if (rf & 2) {
4616    const ctx_r0 = \u0275\u0275nextContext(2);
4617    const isLoading_r4 = \u0275\u0275readContextLet(0);
4618    \u0275\u0275property("label", isLoading_r4 ? "GLOBAL.PROGRESS.WAITING" : "MESSENGER.SAVE_IDEA")("isLoading", isLoading_r4)("disabled", ctx_r0.errors().length > 0 || isLoading_r4)("ngClass", \u0275\u0275pureFunction1(4, _c05, isLoading_r4));
4619  }
4620}
4621function PublisherComponent_Conditional_4_Conditional_4_Template(rf, ctx) {
4622  if (rf & 1) {
4623    const _r7 = \u0275\u0275getCurrentView();
4624    \u0275\u0275elementStart(0, "ui-button", 16);
4625    \u0275\u0275listener("click", function PublisherComponent_Conditional_4_Conditional_4_Template_ui_button_click_0_listener() {
4626      \u0275\u0275restoreView(_r7);
4627      const ctx_r0 = \u0275\u0275nextContext(2);
4628      return \u0275\u0275resetView(ctx_r0.executeMainAction());
4629    });
4630    \u0275\u0275elementEnd();
4631  }
4632  if (rf & 2) {
4633    const ctx_r0 = \u0275\u0275nextContext(2);
4634    const isLoading_r4 = \u0275\u0275readContextLet(0);
4635    const isScheduler_r8 = \u0275\u0275readContextLet(1);
4636    \u0275\u0275property("styleClass", \u0275\u0275interpolate1("justify-start! px-3! ", !isLoading_r4 && isScheduler_r8 && (!ctx_r0.store.isCyclicList() || ctx_r0.store.isUserType().instagram) && "rounded-r-none!"))("label", isLoading_r4 ? "GLOBAL.PROGRESS.WAITING" : isScheduler_r8 ? "MESSENGER.PROGRAM_POST" : "MESSENGER.PUBLISH_NOW")("isLoading", isLoading_r4)("disabled", ctx_r0.errors().length > 0 || isLoading_r4)("ngClass", \u0275\u0275pureFunction1(6, _c05, isLoading_r4));
4637  }
4638}
4639function PublisherComponent_Conditional_4_Conditional_5_Template(rf, ctx) {
4640  if (rf & 1) {
4641    const _r9 = \u0275\u0275getCurrentView();
4642    \u0275\u0275elementStart(0, "ui-button", 17);
4643    \u0275\u0275pipe(1, "translate");
4644    \u0275\u0275listener("click", function PublisherComponent_Conditional_4_Conditional_5_Template_ui_button_click_0_listener() {
4645      \u0275\u0275restoreView(_r9);
4646      const ctx_r0 = \u0275\u0275nextContext(2);
4647      return \u0275\u0275resetView(ctx_r0.messengerFacade.update(ctx_r0.store.post()));
4648    });
4649    \u0275\u0275elementEnd();
4650  }
4651  if (rf & 2) {
4652    const ctx_r0 = \u0275\u0275nextContext(2);
4653    const isLoading_r4 = \u0275\u0275readContextLet(0);
4654    const isScheduler_r8 = \u0275\u0275readContextLet(1);
4655    \u0275\u0275property("styleClass", \u0275\u0275interpolate1("justify-start! px-3! ", !isLoading_r4 && isScheduler_r8 && (!ctx_r0.store.isCyclicList() || ctx_r0.store.isUserType().instagram) && "rounded-r-none!"))("label", isLoading_r4 ? "GLOBAL.PROGRESS.WAITING" : "MESSENGER.EDIT_PO
4655ST")("isLoading", isLoading_r4)("tooltip", ctx_r0.store.post().status.is.toApproval || ctx_r0.store.post().status.is.rejected ? \u0275\u0275pipeBind1(1, 8, "MESSENGER.EDIT_TO_POST") : "")("tooltipPosition", "top")("disabled", ctx_r0.errors().length > 0 || isLoading_r4)("ngClass", \u0275\u0275pureFunction1(10, _c05, isLoading_r4));
4656  }
4657}
4658function PublisherComponent_Conditional_4_Conditional_6_Template(rf, ctx) {
4659  if (rf & 1) {
4660    const _r10 = \u0275\u0275getCurrentView();
4661    \u0275\u0275elementStart(0, "ui-button", 18);
4662    \u0275\u0275listener("click", function PublisherComponent_Conditional_4_Conditional_6_Template_ui_button_click_0_listener($event) {
4663      \u0275\u0275restoreView(_r10);
4664      \u0275\u0275nextContext();
4665      const publishMenu_r11 = \u0275\u0275reference(8);
4666      return \u0275\u0275resetView(publishMenu_r11.toggle($event));
4667    });
4668    \u0275\u0275elementEnd();
4669  }
4670  if (rf & 2) {
4671    const ctx_r0 = \u0275\u0275nextContext(2);
4672    const isLoading_r4 = \u0275\u0275readContextLet(0);
4673    \u0275\u0275property("isLoading", isLoading_r4)("disabled", ctx_r0.errors().length > 0 || isLoading_r4)("ngClass", \u0275\u0275pureFunction1(3, _c13, isLoading_r4));
4674  }
4675}
4676function PublisherComponent_Conditional_4_ng_template_9_Template(rf, ctx) {
4677  if (rf & 1) {
4678    \u0275\u0275elementStart(0, "button", 19);
4679    \u0275\u0275element(1, "ui-icon", 20);
4680    \u0275\u0275elementStart(2, "span", 21);
4681    \u0275\u0275text(3);
4682    \u0275\u0275pipe(4, "translate");
4683    \u0275\u0275elementEnd()();
4684  }
4685  if (rf & 2) {
4686    const item_r12 = ctx.$implicit;
4687    \u0275\u0275advance();
4688    \u0275\u0275property("name", item_r12.icon);
4689    \u0275\u0275advance(2);
4690    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 2, item_r12.label));
4691  }
4692}
4693function PublisherComponent_Conditional_4_Template(rf, ctx) {
4694  if (rf & 1) {
4695    const _r2 = \u0275\u0275getCurrentView();
4696    \u0275\u0275elementStart(0, "div", 5);
4697    \u0275\u0275conditionalCreate(1, PublisherComponent_Conditional_4_Conditional_1_Template, 2, 10, "ui-button", 6);
4698    \u0275\u0275elementStart(2, "div", 7);
4699    \u0275\u0275listener("mouseenter", function PublisherComponent_Conditional_4_Template_div_mouseenter_2_listener($event) {
4700      \u0275\u0275restoreView(_r2);
4701      const errorList_r5 = \u0275\u0275reference(12);
4702      const ctx_r0 = \u0275\u0275nextContext();
4703      return \u0275\u0275resetView(ctx_r0.errors().length && errorList_r5.show($event));
4704    })("mouseleave", function PublisherComponent_Conditional_4_Template_div_mouseleave_2_listener() {
4705      \u0275\u0275restoreView(_r2);
4706      const errorList_r5 = \u0275\u0275reference(12);
4707      const ctx_r0 = \u0275\u0275nextContext();
4708      return \u0275\u0275resetView(ctx_r0.errors().length && errorList_r5.hide());
4709    });
4710    \u0275\u0275conditionalCreate(3, PublisherComponent_Conditional_4_Conditional_3_Template, 1, 6, "ui-button", 8)(4, PublisherComponent_Conditional_4_Conditional_4_Template, 1, 8, "ui-button", 9)(5, PublisherComponent_Conditional_4_Conditional_5_Template, 2, 12, "ui-button", 10);
4711    \u0275\u0275conditionalCreate(6, PublisherComponent_Conditional_4_Conditional_6_Template, 1, 5, "ui-button", 11);
4712    \u0275\u0275elementEnd()();
4713    \u0275\u0275elementStart(7, "ui-menu", 12, 0);
4714    \u0275\u0275template(9, PublisherComponent_Conditional_4_ng_template_9_Template, 5, 4, "ng-template", null, 1, \u0275\u0275templateRefExtractor);
4715    \u0275\u0275elementEnd();
4716    \u0275\u0275element(11, "app-error-list", 13, 2);
4717  }
4718  if (rf & 2) {
4719    const ctx_r0 = \u0275\u0275nextContext();
4720    const isLoading_r4 = \u0275\u0275readContextLet(0);
4721    const isScheduler_r8 = \u0275\u0275readContextLet(1);
4722    const isNew_r13 = \u0275\u0275readContextLet(2);
4723    \u0275\u0275advance();
4724    \u0275\u0275conditional(isScheduler_r8 && !isLoading_r4 && !ctx_r0.store.isCyclicList() ? 1 : -1);
4725    \u0275\u0275advance(2);
4726    \u0275\u0275conditional(ctx_r0.store.post().status.is.idea ? 3 : isNew_r13 ? 4 : 5);
4727    \u0275\u0275advance(3);
4728    \u0275\u0275conditional(isScheduler_r8 && !ctx_r0.store.post().status.is.idea && (!ctx_r0.store.isCyclicList() || ctx_r0.store.isUserType().instagram) ? 6 : -1);
4729    \u0275\u0275advance();
4730    \u0275\u0275property("items", ctx_r0.items());
4731    \u0275\u0275advance(4);
4732    \u0275\u0275property("errors", ctx_r0.errors());
4733  }
4734}
4735var PublisherComponent = class _PublisherComponent extends BaseComponent {
4736  messengerFacade;
4737  store = inject(MessengerStore);
4738  personalized = inject(MessengerPersonalizedService);
4739  isMultimediaLoading = signal(false);
4740  isSuccess = signal(false);
4741  successLabel = signal("");
4742  errors = computed(() => {
4743    const post = this.store.post();
4744    const personalized = this.store.personalized();
4745    const domainErrors = !personalized.active ? post.validateAll().value || [] : post.validateAll(__spreadProps(__spreadValues({}, personalized.map), {
4746      [String(this.store.userType())]: {
4747        message: post.message.value,
4748        multimediaList: post.multimediaList,
4749        threadPosts: post.threadPosts
4750      }
4751    })).value || [];
4752    return [...domainErrors, ...this.urlQuotaErrors()];
4753  });
4754  urlQuota = inject(UrlQuotaService);
4755  // Follows the platform pattern the PO asked for: a link-post quota that does
4756  // not cover the publication disables publishing like any other validation
4757  // error, with the reason in the same hover popover. It is a courtesy, not the
4758  // gate — the API rejects the publication anyway, and does so again at send
4759  // time.
4760  urlQuotaErrors = computed(() => {
4761    const post = this.store.post();
4762    const at = post.scheduler.is.present ? post.scheduler.first.date ?? null : null;
4763    const units = post.urlQuotaUnits(this.personalizedXContent());
4764    if (this.urlQuota.fitsAt(at, units))
4765      return [];
4766    const available = this.urlQuota.remainingAt(at);
4767    return [
4768      {
4769        // Nothing left at all reads differently from "you have some, but not
4770        // enough for this one" — and the second is the only thing a client
4771        // with a half-spent quota can act on.
4772        code: available === 0 ? "X_URL_QUOTA_EXCEEDED" : "X_URL_QUOTA_NOT_ENOUGH",
4773        userType: UserType.X,
4774        meta: {
4775          total: this.urlQuota.totalAt(at),
4776          date: this.urlQuota.resetLabelAt(at),
4777          needed: units,
4778          available
4779        }
4780      }
4781    ];
4782  });
4783  /**
4784   * El texto de X cuando cada red tiene el suyo, o undefined si no hay
4785   * personalizacion y el del post ya es el de todas.
4786   *
4787   * La pestana abierta vive en el post; las demas, en el mapa. Cambiar de
4788   * pestana guarda la anterior antes de cargar la nueva, asi que el mapa esta
4789   * al dia para las que no se estan viendo.
4790   */
4791  personalizedXContent() {
4792    if (!this.personalized.isEnabled)
4793      return void 0;
4794    const post = this.store.post();
4795    if (this.store.userType() === UserType.X) {
4796      return { message: post.message.value, threadPosts: post.threadPosts };
4797    }
4798    const data = this.personalized.map[String(UserType.X)];
4799    return { message: data?.message ?? "", threadPosts: data?.threadPosts ?? ThreadPostList.empty() };
4800  }
4801  lastErrorHash = "";
4802  constructor(messengerFacade) {
4803    super();
4804    this.messengerFacade = messengerFacade;
4805    effect(() => {
4806      const errors = this.errors();
4807      const hash = errors.map((e) => e.code).sort().join(",");
4808      if (hash !== this.lastErrorHash) {
4809        this.lastErrorHash = hash;
4810        untracked(() => this.store.refresh());
4811      }
4812    });
4813  }
4814  items = computed(() => {
4815    if (this.store.post().status.is.idea)
4816      return [];
4817    const isCyclicInstagram = this.store.isCyclicList() && this.store.isUserType().instagram;
4818    return [
4819      {
4820        icon: "zap",
4821        label: "GLOBAL.PUBLISH_NOW",
4822        visible: !isCyclicInstagram && !this.store.isThread().active && !!this.store.scheduler() && this.store.post().is.new && !this.store.post().multimediaList.has.some.coverFrame,
4823        command: () => this.executeAction("publishNow")
4824      },
4825      {
4826        icon: "bellRing",
4827        label: "MESSENGER.SCHEDULE_NOTIFICATION",
4828        visible: (this.store.post().userList.hasInstagram || this.store.post().userList.hasTiktok) && !this.store.post().is.push,
4829        command: () => this.executeAction("sendToPush")
4830      },
4831      {
4832        icon: "clock",
4833        label: "MESSENGER.PROGRAM_AUTO",
4834        visible: this.store.post().is.push && !this.store.post().is.new,
4835        command: () => this.executeAction("schedule")
4836      },
4837      {
4838        icon: "bookmark",
4839        label: "MESSENGER.SAVE_AS_DRAFT",
4840        visible: !isCyclicInstagram,
4841        command: () => this.executeAction("draft")
4842      },
4843      {
4844        icon: "bookmark",
4845        label: "MESSENGER.PROGRAM_POST",
4846        visible: !isCyclicInstagram && !this.store.scheduler(),
4847        command: () => this.executeAction("schedule")
4848      }
4849    ];
4850  });
4851  ngOnInit() {
4852    void this.urlQuota.ensureLoaded();
4853    this.bus.on(UploaderLoadingEvent).pipe(this.unsubscribe()).subscribe(({ isLoading }) => {
4854      this.isMultimediaLoading.set(isLoading);
4855      if (!isLoading)
4856        sleep(100).then(() => this.store.refresh());
4857    });
4858    this.bus.once(PostCompletedEvent).pipe(this.unsubscribe()).subscribe(() => {
4859      const label = this.store.scheduler() ? "MESSENGER.SCHEDULE_SUCCESS" : "MESSENGER.PUBLISH_NOW_SUCCESS";
4860      this.successLabel.set(label);
4861      this.isSuccess.set(true);
4862      void this.urlQuota.refresh();
4863    });
4864  }
4865  executeAction(action) {
4866    const post = this.store.post();
4867    if (this.store.personalized().active) {
4868      this.personalized.saveCurrentTab();
4869      this.messengerFacade.publishPersonalized(action, post, this.personalized.map);
4870    } else {
4871      this.messengerFacade[action](post);
4872    }
4873  }
4874  executeMainAction() {
4875    if (this.store.post().status.is.idea) {
4876      this.messengerFacade.saveIdea(this.store.post());
4877      return;
4878    }
4879    this.executeAction(this.store.scheduler() ? "schedule" : "publishNow");
4880  }
4881  static \u0275fac = function PublisherComponent_Factory(__ngFactoryType__) {
4882    return new (__ngFactoryType__ || _PublisherComponent)(\u0275\u0275directiveInject(MessengerFacade));
4883  };
4884  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _PublisherComponent, selectors: [["app-publisher"]], features: [\u0275\u0275InheritDefinitionFeature], decls: 5, vars: 4, consts: [["publishMenu", ""], ["item", ""], ["errorList", ""], [1, "mt-6"], [3, "label"], [1, "flex", "gap-3", "mt-6"], ["icon", "clipboardCheck", "severity", "contrast", "size", "large", "styleClass", "aspect-square", 3, "isLoading", "tooltip", "tooltipPosition", "hidden", "disabled", "ngClass"], [1, "w-full", "grid", "grid-cols-[1fr_auto]", 3, "mouseenter", "mouseleave"], ["size", "large", "styleClass", "justify-start! px-3!", 3, "label", "isLoading", "disabled", "ngClass"], ["size", "large", 3, "label", "isLoading", "disabled", "styleClass", "ngClass"], ["size", "large", 3, "label", "isLoading", "tooltip", "tooltipPosition", "disabled", "styleClass", "ngClass"], ["icon", "chevronDown", "size", "large", "styleClass", "size-[3.05rem] px-3! aspect-square rounded-l-none! border-l-grey-50/20!", 3, "isLoading", "disabled", "ngClass"], ["styleClass", "my-2!", 3, "items"], [3, "errors"], ["icon", "clipboardCheck", "severity", "contrast", "size", "large", "styleClass", "aspect-square", 3, "click", "isLoading", "tooltip", "tooltipPosition", "hidden", "disabled", "ngClass"], ["size", "large", "styleClass", "justify-start! px-3!", 3, "click", "label", "isLoading", "disabled", "ngClass"], ["size", "large", 3, "click", "label", "isLoading", "disabled", "styleClass", "ngClass"], ["size", "large", 3, "click", "label", "isLoading", "tooltip", "tooltipPosition", "disabled", "styleClass", "ngClass"], ["icon", "chevronDown", "size", "large", "styleClass", "size-[3.05rem] px-3! aspect-square rounded-l-none! border-l-grey-50/20!", 3, "click", "isLoading", "disabled", "ngClass"], [1, "w-full", "flex", "items-center", "cursor-pointer", "py-2", "gap-4!", "px-0!", "mb-2"], ["styleClass", "size-5!", 3, "name"], [1, "font-sans!"]], template: function PublisherComponent_Template(rf, ctx) {
4885    if (rf & 1) {
4886      \u0275\u0275declareLet(0)(1)(2);
4887      \u0275\u0275conditionalCreate(3, PublisherComponent_Conditional_3_Template, 2, 1, "div", 3)(4, PublisherComponent_Conditional_4_Template, 13, 5);
4888    }
4889    if (rf & 2) {
4890      \u0275\u0275storeLet(ctx.loaderStore.isEnable() || ctx.isMultimediaLoading() || ctx.store.isSendingInstant());
4891      \u0275\u0275advance();
4892      \u0275\u0275storeLet(ctx.store.scheduler());
4893      \u0275\u0275advance();
4894      \u0275\u0275storeLet(ctx.store.post().is.new);
4895      \u0275\u0275advance();
4896      \u0275\u0275conditional(ctx.isSuccess() ? 3 : 4);
4897    }
4898  }, dependencies: [
4899    CommonModule,
4900    NgClass,
4901    TranslatePipe,
4902    ErrorListComponent,
4903    PublicationSuccessComponent,
4904    ButtonComponent,
4905    MenuComponent,
4906    IconComponent,
4907    TooltipDirective
4908  ], encapsulation: 2 });
4909};
4910(() => {
4911  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PublisherComponent, [{
4912    type: Component,
4913    args: [{ selector: "app-publisher", imports: [
4914      CommonModule,
4915      TranslatePipe,
4916      ErrorListComponent,
4917      PublicationSuccessComponent,
4918      ButtonComponent,
4919      MenuComponent,
4920      IconComponent,
4921      TooltipDirective
4922    ], template: `@let isLoading = loaderStore.isEnable() || isMultimediaLoading() || store.isSendingInstant(); @let isScheduler =
4923store.scheduler(); @let isNew = store.post().is.new; @if (isSuccess()) {
4924<div class="mt-6">
4925  <app-publication-success [label]="successLabel()" />
4926</div>
4927} @else {
4928<div class="flex gap-3 mt-6">
4929  @if(isScheduler && !isLoading && !store.isCyclicList()){
4930  <ui-button
4931    (click)="executeAction('sendToApproval')"
4932    icon="clipboardCheck"
4933    severity="contrast"
4934    size="large"
4935    [isLoading]="isLoading"
4936    [tooltip]="'POSTS.APPROVE' | translate"
4937    [tooltipPosition]="'top'"
4938    [hidden]="errors().length"
4939    [disabled]="isLoading"
4940    styleClass="aspect-square"
4941    [ngClass]="{ 'pointer-events-none': isLoading }"
4942  />
4943  }
4944  <div
4945    (mouseenter)="errors().length && errorList.show($event)"
4946    (mouseleave)="errors().length && errorList.hide()"
4947    class="w-full grid grid-cols-[1fr_auto]"
4948  >
4949    <!-- Ideas always save via executeMainAction() -> saveIdea() (store on create,
4950    kanban/idea/update on edit), so the button must stay visible in edit mode too. -->
4951    @if(store.post().status.is.idea){
4952    <ui-button
4953      (click)="executeMainAction()"
4954      [label]="isLoading ? 'GLOBAL.PROGRESS.WAITING' : 'MESSENGER.SAVE_IDEA'"
4955      [isLoading]="isLoading"
4956      size="large"
4957      [disabled]="errors().length > 0 || isLoading"
4958      styleClass="justify-start! px-3!"
4959      [ngClass]="{ 'pointer-events-none': isLoading }"
4960    />
4961    } @else if(isNew){
4962    <ui-button
4963      (click)="executeMainAction()"
4964      [label]="isLoading ? 'GLOBAL.PROGRESS.WAITING' : isScheduler ? 'MESSENGER.PROGRAM_POST' : 'MESSENGER.PUBLISH_NOW'"
4965      [isLoading]="isLoading"
4966      size="large"
4967      [disabled]="errors().length > 0 || isLoading"
4968      styleClass="justify-start! px-3! {{
4969        !isLoading && isScheduler && (!store.isCyclicList() || store.isUserType().instagram) && 'rounded-r-none!'
4970      }}"
4971      [ngClass]="{ 'pointer-events-none': isLoading }"
4972    />
4973    } @else {
4974    <ui-button
4975      (click)="messengerFacade.update(store.post())"
4976      [label]="isLoading ? 'GLOBAL.PROGRESS.WAITING' : 'MESSENGER.EDIT_PO
4976ST'"
4977      [isLoading]="isLoading"
4978      [tooltip]="
4979        store.post().status.is.toApproval || store.post().status.is.rejected
4980          ? ('MESSENGER.EDIT_TO_POST' | translate)
4981          : ''
4982      "
4983      [tooltipPosition]="'top'"
4984      size="large"
4985      [disabled]="errors().length > 0 || isLoading"
4986      styleClass="justify-start! px-3! {{
4987        !isLoading && isScheduler && (!store.isCyclicList() || store.isUserType().instagram) && 'rounded-r-none!'
4988      }}"
4989      [ngClass]="{ 'pointer-events-none': isLoading }"
4990    />
4991    } @if(isScheduler && !store.post().status.is.idea && (!store.isCyclicList() || store.isUserType().instagram)){
4992    <ui-button
4993      (click)="publishMenu.toggle($event)"
4994      icon="chevronDown"
4995      size="large"
4996      [isLoading]="isLoading"
4997      [disabled]="errors().length > 0 || isLoading"
4998      styleClass="size-[3.05rem] px-3! aspect-square rounded-l-none! border-l-grey-50/20!"
4999      [ngClass]="{ hidden: isLoading }"
5000    />
5001    }
5002  </div>
5003</div>
5004
5005<ui-menu #publishMenu [items]="items()" styleClass="my-2!">
5006  <ng-template #item let-item>
5007    <button class="w-full flex items-center cursor-pointer py-2 gap-4! px-0! mb-2">
5008      <ui-icon [name]="item.icon" styleClass="size-5!" />
5009      <span class="font-sans!">{{ item.label | translate }}</span>
5010    </button>
5011  </ng-template>
5012</ui-menu>
5013
5014<app-error-list #errorList [errors]="errors()" />
5015}
5016` }]
5017  }], () => [{ type: MessengerFacade }], null);
5018})();
5019(() => {
5020  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(PublisherComponent, { className: "PublisherComponent", filePath: "libs/socialgest/messenger/src/presenter/components/scheduler/components/publisher/publisher.component.ts", lineNumber: 35 });
5021})();
5022
5023// libs/socialgest/messenger/src/presenter/components/scheduler/components/programmer/programmer.component.ts
5024var _c06 = ["popover"];
5025var _c14 = (a0) => ({ "text-secondary-500!": a0 });
5026function ProgrammerComponent_ng_template_1_Conditional_3_Template(rf, ctx) {
5027  if (rf & 1) {
5028    \u0275\u0275text(0);
5029    \u0275\u0275pipe(1, "localeDate");
5030  }
5031  if (rf & 2) {
5032    const ctx_r2 = \u0275\u0275nextContext(2);
5033    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind2(1, 1, ctx_r2.store.post().scheduler.first.date, "d 'de' MMMM, h:mm a"), " ");
5034  }
5035}
5036function ProgrammerComponent_ng_template_1_Conditional_4_Template(rf, ctx) {
5037  if (rf & 1) {
5038    \u0275\u0275text(0);
5039    \u0275\u0275pipe(1, "translate");
5040  }
5041  if (rf & 2) {
5042    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(1, 1, "MESSENGER.PROGRAM"), " ");
5043  }
5044}
5045function ProgrammerComponent_ng_template_1_Template(rf, ctx) {
5046  if (rf & 1) {
5047    \u0275\u0275elementStart(0, "button", 13);
5048    \u0275\u0275element(1, "ui-icon", 14);
5049    \u0275\u0275elementStart(2, "span", 15);
5050    \u0275\u0275conditionalCreate(3, ProgrammerComponent_ng_template_1_Conditional_3_Template, 2, 4)(4, ProgrammerComponent_ng_template_1_Conditional_4_Template, 2, 3);
5051    \u0275\u0275elementEnd()();
5052  }
5053  if (rf & 2) {
5054    const ctx_r2 = \u0275\u0275nextContext();
5055    \u0275\u0275property("ngClass", \u0275\u0275pureFunction1(2, _c14, ctx_r2.store.isProgrammed()));
5056    \u0275\u0275advance(3);
5057    \u0275\u0275conditional(ctx_r2.store.isProgrammed() ? 3 : 4);
5058  }
5059}
5060function ProgrammerComponent_For_11_Conditional_2_Template(rf, ctx) {
5061  if (rf & 1) {
5062    const _r6 = \u0275\u0275getCurrentView();
5063    \u0275\u0275elementStart(0, "ui-button", 18);
5064    \u0275\u0275listener("click", function ProgrammerComponent_For_11_Conditional_2_Template_ui_button_click_0_listener() {
5065      \u0275\u0275restoreView(_r6);
5066      const $index_r5 = \u0275\u0275nextContext().$index;
5067      const ctx_r2 = \u0275\u0275nextContext();
5068      return \u0275\u0275resetView(ctx_r2.remove($index_r5));
5069    });
5070    \u0275\u0275elementEnd();
5071  }
5072}
5073function ProgrammerComponent_For_11_Template(rf, ctx) {
5074  if (rf & 1) {
5075    const _r4 = \u0275\u0275getCurrentView();
5076    \u0275\u0275elementStart(0, "div", 7)(1, "ui-datepicker", 16);
5077    \u0275\u0275listener("ngModelChange", function ProgrammerComponent_For_11_Template_ui_datepicker_ngModelChange_1_listener($event) {
5078      const $index_r5 = \u0275\u0275restoreView(_r4).$index;
5079      const ctx_r2 = \u0275\u0275nextContext();
5080      ctx_r2.update($index_r5, $event);
5081      return \u0275\u0275resetView(ctx_r2.confirm({ withClose: false, withRefresh: true }));
5082    });
5083    \u0275\u0275elementEnd();
5084    \u0275\u0275conditionalCreate(2, ProgrammerComponent_For_11_Conditional_2_Template, 1, 0, "ui-button", 17);
5085    \u0275\u0275elementEnd();
5086  }
5087  if (rf & 2) {
5088    const $index_r5 = ctx.$index;
5089    const \u0275$index_27_r7 = ctx.$index;
5090    const ctx_r2 = \u0275\u0275nextContext();
5091    \u0275\u0275advance();
5092    \u0275\u0275property("ngModel", ctx_r2.specificDates()[$index_r5])("showTime", true)("restrict", true)("autoClose", false)("autoFocus", true);
5093    \u0275\u0275advance();
5094    \u0275\u0275conditional(!(\u0275$index_27_r7 === 0) ? 2 : -1);
5095  }
5096}
5097function ProgrammerComponent_Conditional_12_Template(rf, ctx) {
5098  if (rf & 1) {
5099    const _r8 = \u0275\u0275getCurrentView();
5100    \u0275\u0275elementStart(0, "ui-button", 19);
5101    \u0275\u0275listener("click", function ProgrammerComponent_Conditional_12_Template_ui_button_click_0_listener() {
5102      \u0275\u0275restoreView(_r8);
5103      const ctx_r2 = \u0275\u0275nextContext();
5104      return \u0275\u0275resetView(ctx_r2.insert());
5105    });
5106    \u0275\u0275elementEnd();
5107  }
5108}
5109var ProgrammerComponent = class _ProgrammerComponent {
5110  store = inject(MessengerStore);
5111  cyclicListStore = inject(CyclicListStore);
5112  popover = viewChild.required("popover");
5113  specificDates = signal([$date($date().plus.minutes(10)).reset.milliseconds()]);
5114  ngOnInit() {
5115    is.affirmative(this.store.post().scheduler.is.present).mapRight(() => {
5116      when(this.specificDates.set(this.store.post().scheduler.specificDates)).map(() => this.confirm());
5117    });
5118    is.affirmative(this.store.post().is.new).mapRight(() => {
5119      const reusedDate = this.store.post().date;
5120      if (reusedDate)
5121        this.specificDates.set([reusedDate]);
5122      this.confirm();
5123    }).mapLeft(() => {
5124      when(this.specificDates.set([this.store.post().date])).map(() => this.confirm({ withClose: false, withRefresh: true }));
5125    });
5126  }
5127  close() {
5128    this.popover().hide();
5129  }
5130  insert() {
5131    this.specificDates.update((d) => [...d, $date(/* @__PURE__ */ new Date()).reset.milliseconds()]);
5132  }
5133  update(index, date) {
5134    this.specificDates.update((d) => d.map((v, i) => i === index ? $date(date).reset.milliseconds() : v));
5135  }
5136  remove(index) {
5137    this.specificDates.update((d) => d.filter((_, i) => i !== index));
5138  }
5139  confirm(opts = { withClose: true, withRefresh: false }) {
5140    when(this.store.post().set.scheduler(this.specificDates())).map(() => {
5141      this.store.post().set.cyclic(Cyclic.empty());
5142      this.cyclicListStore.cyclicList().unselect.all();
5143      this.store.withProgrammed();
5144      if (opts.withRefresh)
5145        this.store.refresh();
5146    }).map(() => opts.withClose && this.close());
5147  }
5148  static \u0275fac = function ProgrammerComponent_Factory(__ngFactoryType__) {
5149    return new (__ngFactoryType__ || _ProgrammerComponent)();
5150  };
5151  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _ProgrammerComponent, selectors: [["app-programmer"]], viewQuery: function ProgrammerComponent_Query(rf, ctx) {
5152    if (rf & 1) {
5153      \u0275\u0275viewQuerySignal(ctx.popover, _c06, 5);
5154    }
5155    if (rf & 2) {
5156      \u0275\u0275queryAdvance();
5157    }
5158  }, decls: 18, vars: 8, consts: [["item", ""], ["popover", ""], [1, "segment-thin", 3, "click", "value", "selectable", "styleClass"], ["styleClass", "w-[23rem] -ml-7 -mt-3! p-6 no-gutter"], [1, "flex", "flex-col", "gap-3"], [1, "text-sm", "font-semibold"], [1, "flex", "flex-col", "gap-3", "h-60", "overflow-y-auto", "pb-2"], [1, "flex", "gap-2", "items-center"], ["label", "MESSENGER.ADD_ANOTHER_DATE", "icon", "plus", "severity", "contrast", 1, "w-full"], [3, "timezoneChange"], [1, "flex", "gap-3", "mt-4"], ["label", "GLOBAL.CANCEL", "severity", "contrast", 1, "w-full", 3, "click"], ["label", "GLOBAL.CONFIRM", "severity", "secondary", 1, "w-full", 3, "click"], [1, "flex", "items-center", "gap-2", "text-grey-300", "cursor-pointer", 3, "ngClass"], ["name", "calendarClock", "styleClass", "size-5"], [1, "font-display", "text-sm", "font-bold"], [1, "w-full", "p-[.075rem]", 3, "ngModelChange", "ngModel", "showTime", "restrict", "autoClose", "autoFocus"], ["icon", "trash", "severity", "contrast", "styleClass", "aspect-square"], ["icon", "trash", "severity", "contrast", "styleClass", "aspect-square", 3, "click"], ["label", "MESSENGER.ADD_ANOTHER_DATE", "icon", "plus", "severity", "contrast", 1, "w-full", 3, "click"]], template: function ProgrammerComponent_Template(rf, ctx) {
5159    if (rf & 1) {
5160      const _r1 = \u0275\u0275getCurrentView();
5161      \u0275\u0275elementStart(0, "ui-segment", 2);
5162      \u0275\u0275listener("click", function ProgrammerComponent_Template_ui_segment_click_0_listener($event) {
5163        \u0275\u0275restoreView(_r1);
5164        const popover_r2 = \u0275\u0275reference(4);
5165        return \u0275\u0275resetView(popover_r2.toggle($event));
5166      });
5167      \u0275\u0275template(1, ProgrammerComponent_ng_template_1_Template, 5, 4, "ng-template", null, 0, \u0275\u0275templateRefExtractor);
5168      \u0275\u0275elementEnd();
5169      \u0275\u0275elementStart(3, "ui-popover", 3, 1)(5, "section", 4)(6, "h3", 5);
5170      \u0275\u0275text(7);
5171      \u0275\u0275pipe(8, "translate");
5172      \u0275\u0275elementEnd();
5173      \u0275\u0275elementStart(9, "div", 6);
5174      \u0275\u0275repeaterCreate(10, ProgrammerComponent_For_11_Template, 3, 6, "div", 7, \u0275\u0275repeaterTrackByIndex);
5175      \u0275\u0275conditionalCreate(12, ProgrammerComponent_Conditional_12_Template, 1, 0, "ui-button", 8);
5176      \u0275\u0275elementEnd()();
5177      \u0275\u0275elementStart(13, "section")(14, "ui-select-timezone", 9);
5178      \u0275\u0275listener("timezoneChange", function ProgrammerComponent_Template_ui_select_timezone_timezoneChange_14_listener() {
5179        \u0275\u0275restoreView(_r1);
5180        return \u0275\u0275resetView(ctx.store.refresh());
5181      });
5182      \u0275\u0275elementEnd()();
5183      \u0275\u0275elementStart(15, "footer", 10)(16, "ui-button", 11);
5184      \u0275\u0275listener("click", function ProgrammerComponent_Template_ui_button_click_16_listener() {
5185        \u0275\u0275restoreView(_r1);
5186        return \u0275\u0275resetView(ctx.close());
5187      });
5188      \u0275\u0275elementEnd();
5189      \u0275\u0275elementStart(17, "ui-button", 12);
5190      \u0275\u0275listener("click", function ProgrammerComponent_Template_ui_button_click_17_listener() {
5191        \u0275\u0275restoreView(_r1);
5192        ctx.confirm();
5193        return \u0275\u0275resetView(ctx.close());
5194      });
5195      \u0275\u0275elementEnd()()();
5196    }
5197    if (rf & 2) {
5198      const popover_r2 = \u0275\u0275reference(4);
5199      \u0275\u0275property("styleClass", \u0275\u0275interpolate1("border-grey-100 ", popover_r2.isOpen() && "bg-grey-50/40!"))("value", ctx.store.isProgrammed())("selectable", false);
5200      \u0275\u0275advance(7);
5201      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(8, 6, "MESSENGER.SELECT_DATE_TIME"));
5202      \u0275\u0275advance(3);
5203      \u0275\u0275repeater(ctx.specificDates());
5204      \u0275\u0275advance(2);
5205      \u0275\u0275conditional(ctx.store.post().is.new ? 12 : -1);
5206    }
5207  }, dependencies: [CommonModule, NgClass, FormsModule, NgControlStatus, NgModel, TranslatePipe, LocaleDatePipe, SegmentComponent, IconComponent, PopoverComponent, DatepickerComponent, ButtonComponent, SelectTimezoneComponent], encapsulation: 2 });
5208};
5209(() => {
5210  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ProgrammerComponent, [{
5211    type: Component,
5212    args: [{ selector: "app-programmer", imports: [
5213      CommonModule,
5214      FormsModule,
5215      TranslatePipe,
5216      LocaleDatePipe,
5217      SegmentComponent,
5218      IconComponent,
5219      PopoverComponent,
5220      DatepickerComponent,
5221      ButtonComponent,
5222      SelectTimezoneComponent
5223    ], template: `<ui-segment
5224  (click)="popover.toggle($event)"
5225  [value]="store.isProgrammed()"
5226  [selectable]="false"
5227  styleClass="border-grey-100 {{ popover.isOpen() && 'bg-grey-50/40!' }}"
5228  class="segment-thin"
5229>
5230  <ng-template #item>
5231    <button
5232      class="flex items-center gap-2 text-grey-300 cursor-pointer"
5233      [ngClass]="{ 'text-secondary-500!': store.isProgrammed() }"
5234    >
5235      <ui-icon name="calendarClock" styleClass="size-5" />
5236      <span class="font-display text-sm font-bold">
5237        @if(store.isProgrammed()){
5238        {{ store.post().scheduler.first.date | localeDate : "d 'de' MMMM, h:mm a" }}
5239        }@else{
5240        {{ 'MESSENGER.PROGRAM' | translate }}
5241        }
5242      </span>
5243    </button>
5244  </ng-template>
5245</ui-segment>
5246
5247<ui-popover #popover styleClass="w-[23rem] -ml-7 -mt-3! p-6 no-gutter">
5248  <section class="flex flex-col gap-3">
5249    <h3 class="text-sm font-semibold">{{ 'MESSENGER.SELECT_DATE_TIME' | translate }}</h3>
5250
5251    <div class="flex flex-col gap-3 h-60 overflow-y-auto pb-2">
5252      @for (date of specificDates(); track $index; let first = $first) {
5253      <div class="flex gap-2 items-center">
5254        <ui-datepicker
5255          [ngModel]="specificDates()[$index]"
5256          (ngModelChange)="update($index, $event); confirm({ withClose: false, withRefresh: true })"
5257          [showTime]="true"
5258          [restrict]="true"
5259          [autoClose]="false"
5260          [autoFocus]="true"
5261          class="w-full p-[.075rem]"
5262        />
5263        @if (!first) {
5264        <ui-button (click)="remove($index)" icon="trash" severity="contrast" styleClass="aspect-square" />
5265        }
5266      </div>
5267      } @if(store.post().is.new){
5268      <ui-button (click)="insert()" label="MESSENGER.ADD_ANOTHER_DATE" icon="plus" severity="contrast" class="w-full" />
5269      }
5270    </div>
5271  </section>
5272
5273  <section>
5274    <ui-select-timezone (timezoneChange)="store.refresh()" />
5275  </section>
5276
5277  <footer class="flex gap-3 mt-4">
5278    <ui-button (click)="close()" label="GLOBAL.CANCEL" severity="contrast" class="w-full" />
5279    <ui-button (click)="confirm(); close()" label="GLOBAL.CONFIRM" severity="secondary" class="w-full" />
5280  </footer>
5281</ui-popover>
5282` }]
5283  }], null, null);
5284})();
5285(() => {
5286  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(ProgrammerComponent, { className: "ProgrammerComponent", filePath: "libs/socialgest/messenger/src/presenter/components/scheduler/components/programmer/programmer.component.ts", lineNumber: 25 });
5287})();
5288
5289// libs/socialgest/messenger/src/presenter/components/scheduler/components/with-ai/with-ai.component.ts
5290var _c07 = (a0) => ({ "pointer-events-none": a0 });
5291function WithAiComponent_ng_template_1_Conditional_1_Template(rf, ctx) {
5292  if (rf & 1) {
5293    \u0275\u0275element(0, "ui-icon", 3);
5294    \u0275\u0275elementStart(1, "span", 4);
5295    \u0275\u0275text(2);
5296    \u0275\u0275pipe(3, "translate");
5297    \u0275\u0275elementEnd();
5298  }
5299  if (rf & 2) {
5300    \u0275\u0275advance(2);
5301    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(3, 1, "GLOBAL.PROGRESS.WAITING"));
5302  }
5303}
5304function WithAiComponent_ng_template_1_Conditional_2_Conditional_2_Template(rf, ctx) {
5305  if (rf & 1) {
5306    \u0275\u0275text(0);
5307    \u0275\u0275pipe(1, "localeDate");
5308  }
5309  if (rf & 2) {
5310    const ctx_r1 = \u0275\u0275nextContext(3);
5311    \u0275\u0275textInterpolate1("", \u0275\u0275pipeBind2(1, 1, ctx_r1.store.post().scheduler.first.date, "d 'de' MMMM, h:mm a"), " ");
5312  }
5313}
5314function WithAiComponent_ng_template_1_Conditional_2_Conditional_3_Template(rf, ctx) {
5315  if (rf & 1) {
5316    \u0275\u0275text(0);
5317    \u0275\u0275pipe(1, "translate");
5318  }
5319  if (rf & 2) {
5320    \u0275\u0275textInterpolate1("", \u0275\u0275pipeBind1(1, 1, "MESSENGER.WITH_AI"), " ");
5321  }
5322}
5323function WithAiComponent_ng_template_1_Conditional_2_Template(rf, ctx) {
5324  if (rf & 1) {
5325    \u0275\u0275element(0, "ui-icon", 5);
5326    \u0275\u0275elementStart(1, "span");
5327    \u0275\u0275conditionalCreate(2, WithAiComponent_ng_template_1_Conditional_2_Conditional_2_Template, 2, 4)(3, WithAiComponent_ng_template_1_Conditional_2_Conditional_3_Template, 2, 3);
5328    \u0275\u0275elementEnd();
5329  }
5330  if (rf & 2) {
5331    const ctx_r1 = \u0275\u0275nextContext(2);
5332    \u0275\u0275advance();
5333    \u0275\u0275classMap(ctx_r1.store.isAi() ? "text-secondary-500" : "text-gradient-primary");
5334    \u0275\u0275advance();
5335    \u0275\u0275conditional(ctx_r1.store.isAi() ? 2 : 3);
5336  }
5337}
5338function WithAiComponent_ng_template_1_Template(rf, ctx) {
5339  if (rf & 1) {
5340    \u0275\u0275elementStart(0, "button", 2);
5341    \u0275\u0275conditionalCreate(1, WithAiComponent_ng_template_1_Conditional_1_Template, 4, 3)(2, WithAiComponent_ng_template_1_Conditional_2_Template, 4, 3);
5342    \u0275\u0275elementEnd();
5343  }
5344  if (rf & 2) {
5345    const ctx_r1 = \u0275\u0275nextContext();
5346    \u0275\u0275advance();
5347    \u0275\u0275conditional(ctx_r1.isLoading() ? 1 : 2);
5348  }
5349}
5350var WithAiComponent = class _WithAiComponent {
5351  aiService;
5352  store = inject(MessengerStore);
5353  toastService = inject(SonnerToasterService);
5354  cyclicListStore = inject(CyclicListStore);
5355  analytics = inject(AnalyticsService);
5356  isLoading = signal(false);
5357  constructor(aiService) {
5358    this.aiService = aiService;
5359  }
5360  request() {
5361    this.isLoading.set(true);
5362    this.aiService.getBestDatetime(this.store.post()).subscribe({
5363      next: (result) => {
5364        result.mapRight((bestDatetime) => {
5365          this.analytics.capture("messenger_best_time_requested", {
5366            channels: this.store.post().userList.length,
5367            suggestions: bestDatetime.length
5368          });
5369          when(this.store.post().set.scheduler([random.from(bestDatetime)])).map(() => {
5370            this.store.post().set.cyclic(Cyclic.empty());
5371            this.cyclicListStore.cyclicList().unselect.all();
5372            this.store.withAi();
5373          });
5374        }).mapLeft((error) => {
5375          this.analytics.capture("messenger_best_time_failed");
5376          this.toastService.error(error);
5377        });
5378      },
5379      complete: () => this.isLoading.set(false)
5380    });
5381  }
5382  static \u0275fac = function WithAiComponent_Factory(__ngFactoryType__) {
5383    return new (__ngFactoryType__ || _WithAiComponent)(\u0275\u0275directiveInject(AiService));
5384  };
5385  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _WithAiComponent, selectors: [["app-with-ai"]], decls: 3, vars: 5, consts: [["item", ""], ["styleClass", "border-grey-100", 1, "segment-thin", 3, "click", "value", "selectable", "ngClass"], [1, "flex", "items-center", "gap-2", "text-grey-300", "cursor-pointer", "text-sm", "font-bold", "font-display"], ["name", "loaderCircle", "styleClass", "size-5 animate-spin text-grey-300"], [1, "text-grey-300"], ["name", "images/sh
5385ared/ai-logo.svg", "styleClass", "size-5"]], template: function WithAiComponent_Template(rf, ctx) {
5386    if (rf & 1) {
5387      const _r1 = \u0275\u0275getCurrentView();
5388      \u0275\u0275elementStart(0, "ui-segment", 1);
5389      \u0275\u0275listener("click", function WithAiComponent_Template_ui_segment_click_0_listener() {
5390        \u0275\u0275restoreView(_r1);
5391        return \u0275\u0275resetView(ctx.request());
5392      });
5393      \u0275\u0275template(1, WithAiComponent_ng_template_1_Template, 3, 1, "ng-template", null, 0, \u0275\u0275templateRefExtractor);
5394      \u0275\u0275elementEnd();
5395    }
5396    if (rf & 2) {
5397      \u0275\u0275property("value", ctx.store.isAi() && !ctx.isLoading())("selectable", false)("ngClass", \u0275\u0275pureFunction1(3, _c07, ctx.isLoading()));
5398    }
5399  }, dependencies: [CommonModule, NgClass, TranslatePipe, LocaleDatePipe, SegmentComponent, IconComponent], encapsulation: 2 });
5400};
5401(() => {
5402  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(WithAiComponent, [{
5403    type: Component,
5404    args: [{ selector: "app-with-ai", imports: [CommonModule, TranslatePipe, LocaleDatePipe, SegmentComponent, IconComponent], template: `<ui-segment
5405  (click)="request()"
5406  [value]="store.isAi() && !isLoading()"
5407  [selectable]="false"
5408  styleClass="border-grey-100"
5409  class="segment-thin"
5410  [ngClass]="{ 'pointer-events-none': isLoading() }"
5411>
5412  <ng-template #item let-active="active">
5413    <button class="flex items-center gap-2 text-grey-300 cursor-pointer text-sm font-bold font-display">
5414      @if(isLoading()){
5415      <ui-icon name="loaderCircle" styleClass="size-5 animate-spin text-grey-300" />
5416      <span class="text-grey-300">{{ 'GLOBAL.PROGRESS.WAITING' | translate }}</span>
5417
5418      }@else{
5419
5420      <ui-icon name="images/shared/ai-logo.svg" styleClass="size-5" />
5421      <span class="{{ store.isAi() ? 'text-secondary-500' : 'text-gradient-primary' }}">
5422        @if(store.isAi()){{{ store.post().scheduler.first.date| localeDate : "d 'de' MMMM, h:mm a" }}
5423        }@else{{{ 'MESSENGER.WITH_AI' | translate }} }
5424      </span>
5425      }
5426    </button>
5427  </ng-template>
5428</ui-segment>
5429` }]
5430  }], () => [{ type: AiService }], null);
5431})();
5432(() => {
5433  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(WithAiComponent, { className: "WithAiComponent", filePath: "libs/socialgest/messenger/src/presenter/components/scheduler/components/with-ai/with-ai.component.ts", lineNumber: 14 });
5434})();
5435
5436// libs/socialgest/messenger/src/presenter/components/scheduler/components/cyclic-list/cyclic-list.component.ts
5437var _c08 = ["popover"];
5438var _c15 = (a0) => ({ "text-secondary-500!": a0 });
5439function CyclicListComponent_ng_template_1_Conditional_3_Template(rf, ctx) {
5440  if (rf & 1) {
5441    \u0275\u0275text(0);
5442  }
5443  if (rf & 2) {
5444    const ctx_r2 = \u0275\u0275nextContext(2);
5445    \u0275\u0275textInterpolate1(" ", ctx_r2.store.post().cyclic.name, " ");
5446  }
5447}
5448function CyclicListComponent_ng_template_1_Conditional_4_Template(rf, ctx) {
5449  if (rf & 1) {
5450    \u0275\u0275text(0);
5451    \u0275\u0275pipe(1, "translate");
5452  }
5453  if (rf & 2) {
5454    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(1, 1, "MESSENGER.CYCLIC_LIST"), " ");
5455  }
5456}
5457function CyclicListComponent_ng_template_1_Template(rf, ctx) {
5458  if (rf & 1) {
5459    \u0275\u0275elementStart(0, "button", 6);
5460    \u0275\u0275element(1, "ui-icon", 7);
5461    \u0275\u0275elementStart(2, "span", 8);
5462    \u0275\u0275conditionalCreate(3, CyclicListComponent_ng_template_1_Conditional_3_Template, 1, 1)(4, CyclicListComponent_ng_template_1_Conditional_4_Template, 2, 3);
5463    \u0275\u0275elementEnd()();
5464  }
5465  if (rf & 2) {
5466    const ctx_r2 = \u0275\u0275nextContext();
5467    \u0275\u0275property("ngClass", \u0275\u0275pureFunction1(2, _c15, ctx_r2.store.isCyclicList()));
5468    \u0275\u0275advance(3);
5469    \u0275\u0275conditional(ctx_r2.store.isCyclicList() ? 3 : 4);
5470  }
5471}
5472function CyclicListComponent_ng_template_6_Template(rf, ctx) {
5473  if (rf & 1) {
5474    const _r4 = \u0275\u0275getCurrentView();
5475    \u0275\u0275elementStart(0, "ui-cyclic-list", 9);
5476    \u0275\u0275listener("valueChange", function CyclicListComponent_ng_template_6_Template_ui_cyclic_list_valueChange_0_listener($event) {
5477      \u0275\u0275restoreView(_r4);
5478      const ctx_r2 = \u0275\u0275nextContext();
5479      return \u0275\u0275resetView(ctx_r2.select($event));
5480    });
5481    \u0275\u0275elementEnd();
5482  }
5483  if (rf & 2) {
5484    const cyclicList_r5 = ctx.$implicit;
5485    \u0275\u0275property("cyclicList", cyclicList_r5);
5486  }
5487}
5488var CyclicListComponent2 = class _CyclicListComponent {
5489  store = inject(MessengerStore);
5490  userStore = inject(UserStore);
5491  popover = viewChild.required("popover");
5492  cyclicListStore = inject(CyclicListStore);
5493  constructor() {
5494    inject(CyclicListSubscriber).init();
5495  }
5496  select(cyclicList) {
5497    const cyclic = cyclicList.first;
5498    if (!cyclic)
5499      return;
5500    const available = this.userStore.userList();
5501    const users = cyclic.userList.users.map((cu) => available.users.find((u) => u.id === cu.id) ?? cu);
5502    const userList = UserList.from(users);
5503    userList.select.all();
5504    this.store.post().set.cyclic(cyclic);
5505    this.store.post().set.userList(userList);
5506    this.store.withCyclicList();
5507    this.store.post().reset.scheduler();
5508    this.store.post().reset.date();
5509    this.store.refresh();
5510    this.popover().hide();
5511  }
5512  static \u0275fac = function CyclicListComponent_Factory(__ngFactoryType__) {
5513    return new (__ngFactoryType__ || _CyclicListComponent)();
5514  };
5515  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _CyclicListComponent, selectors: [["app-cyclic-list"]], viewQuery: function CyclicListComponent_Query(rf, ctx) {
5516    if (rf & 1) {
5517      \u0275\u0275viewQuerySignal(ctx.popover, _c08, 5);
5518    }
5519    if (rf & 2) {
5520      \u0275\u0275queryAdvance();
5521    }
5522  }, decls: 8, vars: 8, consts: [["item", ""], ["popover", ""], ["cyclicListTemplate", ""], [1, "segment-thin", 3, "click", "value", "selectable", "styleClass"], ["styleClass", "w-[23rem] h-[23rem] -ml-7 -mt-3! p-0 py-2! no-gutter"], [1, "block", "h-72", "px-4", "py-4", 3, "cyclicList", "size"], [1, "flex", "items-center", "gap-2", "text-grey-300", "cursor-pointer", 3, "ngClass"], ["name", "refreshCcw", "styleClass", "size-5"], [1, "font-display", "text-sm", "font-bold"], ["styleClass", "h-72! py-1.5!", 1, "segment-thin", 2, "--p-card-body-padding", "0.5rem 1rem", 3, "valueChange", "cyclicList"]], template: function CyclicListComponent_Template(rf, ctx) {
5523    if (rf & 1) {
5524      const _r1 = \u0275\u0275getCurrentView();
5525      \u0275\u0275elementStart(0, "ui-segment", 3);
5526      \u0275\u0275listener("click", function CyclicListComponent_Template_ui_segment_click_0_listener($event) {
5527        \u0275\u0275restoreView(_r1);
5528        const popover_r2 = \u0275\u0275reference(4);
5529        return \u0275\u0275resetView(ctx.store.isCyclicLocked() || popover_r2.toggle($event));
5530      });
5531      \u0275\u0275template(1, CyclicListComponent_ng_template_1_Template, 5, 4, "ng-template", null, 0, \u0275\u0275templateRefExtractor);
5532      \u0275\u0275elementEnd();
5533      \u0275\u0275elementStart(3, "ui-popover", 4, 1)(5, "ui-cyclic-list-search", 5);
5534      \u0275\u0275template(6, CyclicListComponent_ng_template_6_Template, 1, 1, "ng-template", null, 2, \u0275\u0275templateRefExtractor);
5535      \u0275\u0275elementEnd()();
5536    }
5537    if (rf & 2) {
5538      const popover_r2 = \u0275\u0275reference(4);
5539      \u0275\u0275classProp("pointer-events-none", ctx.store.isCyclicLocked());
5540      \u0275\u0275property("styleClass", \u0275\u0275interpolate1("border-grey-100 ", popover_r2.isOpen() && "bg-grey-50/40!"))("value", ctx.store.isCyclicList())("selectable", false);
5541      \u0275\u0275advance(5);
5542      \u0275\u0275property("cyclicList", ctx.cyclicListStore.cyclicList())("size", void 0);
5543    }
5544  }, dependencies: [CommonModule, NgClass, TranslatePipe, SegmentComponent, IconComponent, PopoverComponent, CyclicListComponent, CyclicListSearchComponent], encapsulation: 2 });
5545};
5546(() => {
5547  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CyclicListComponent2, [{
5548    type: Component,
5549    args: [{ selector: "app-cyclic-list", imports: [
5550      CommonModule,
5551      TranslatePipe,
5552      SegmentComponent,
5553      IconComponent,
5554      PopoverComponent,
5555      CyclicListComponent,
5556      CyclicListSearchComponent
5557    ], template: `<ui-segment
5558  (click)="store.isCyclicLocked() || popover.toggle($event)"
5559  [value]="store.isCyclicList()"
5560  [selectable]="false"
5561  styleClass="border-grey-100 {{ popover.isOpen() && 'bg-grey-50/40!' }}"
5562  class="segment-thin"
5563  [class.pointer-events-none]="store.isCyclicLocked()"
5564>
5565  <ng-template #item>
5566    <button
5567      class="flex items-center gap-2 text-grey-300 cursor-pointer"
5568      [ngClass]="{ 'text-secondary-500!': store.isCyclicList() }"
5569    >
5570      <ui-icon name="refreshCcw" styleClass="size-5" />
5571      <span class="font-display text-sm font-bold">
5572        @if(store.isCyclicList()){
5573        {{ store.post().cyclic.name }}
5574        }@else{
5575        {{ 'MESSENGER.CYCLIC_LIST' | translate }}
5576        }
5577      </span>
5578    </button>
5579  </ng-template>
5580</ui-segment>
5581
5582<ui-popover #popover styleClass="w-[23rem] h-[23rem] -ml-7 -mt-3! p-0 py-2! no-gutter">
5583  <ui-cyclic-list-search [cyclicList]="cyclicListStore.cyclicList()" [size]="undefined" class="block h-72 px-4 py-4">
5584    <ng-template #cyclicListTemplate let-cyclicList>
5585      <ui-cyclic-list
5586        [cyclicList]="cyclicList"
5587        (valueChange)="select($event)"
5588        styleClass="h-72! py-1.5!"
5589        class="segment-thin"
5590        style="--p-card-body-padding: 0.5rem 1rem"
5591      />
5592    </ng-template>
5593  </ui-cyclic-list-search>
5594</ui-popover>
5595` }]
5596  }], () => [], null);
5597})();
5598(() => {
5599  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(CyclicListComponent2, { className: "CyclicListComponent", filePath: "libs/socialgest/messenger/src/presenter/components/scheduler/components/cyclic-list/cyclic-list.component.ts", lineNumber: 20 });
5600})();
5601
5602// libs/socialgest/messenger/src/presenter/components/scheduler/scheduler.component.ts
5603function SchedulerComponent_Conditional_6_Conditional_4_Template(rf, ctx) {
5604  if (rf & 1) {
5605    \u0275\u0275element(0, "app-programmer");
5606  }
5607}
5608function SchedulerComponent_Conditional_6_Conditional_5_Template(rf, ctx) {
5609  if (rf & 1) {
5610    \u0275\u0275element(0, "app-cyclic-list");
5611  }
5612}
5613function SchedulerComponent_Conditional_6_Conditional_6_Template(rf, ctx) {
5614  if (rf & 1) {
5615    \u0275\u0275element(0, "app-with-ai");
5616  }
5617}
5618function SchedulerComponent_Conditional_6_Template(rf, ctx) {
5619  if (rf & 1) {
5620    \u0275\u0275elementStart(0, "h3", 6);
5621    \u0275\u0275text(1);
5622    \u0275\u0275pipe(2, "translate");
5623    \u0275\u0275elementEnd();
5624    \u0275\u0275elementStart(3, "section", 7);
5625    \u0275\u0275conditionalCreate(4, SchedulerComponent_Conditional_6_Conditional_4_Template, 1, 0, "app-programmer");
5626    \u0275\u0275conditionalCreate(5, SchedulerComponent_Conditional_6_Conditional_5_Template, 1, 0, "app-cyclic-list");
5627    \u0275\u0275conditionalCreate(6, SchedulerComponent_Conditional_6_Conditional_6_Template, 1, 0, "app-with-ai");
5628    \u0275\u0275elementEnd();
5629  }
5630  if (rf & 2) {
5631    const ctx_r0 = \u0275\u0275nextContext();
5632    \u0275\u0275advance();
5633    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(2, 4, "MESSENGER.WHEN_TO_PUBLISH"));
5634    \u0275\u0275advance(3);
5635    \u0275\u0275conditional(!ctx_r0.store.isCyclicLocked() ? 4 : -1);
5636    \u0275\u0275advance();
5637    \u0275\u0275conditional((ctx_r0.store.post().is.new || ctx_r0.store.post().has.cyclic) && !ctx_r0.store.personalized.active() ? 5 : -1);
5638    \u0275\u0275advance();
5639    \u0275\u0275conditional(!ctx_r0.store.isCyclicLocked() ? 6 : -1);
5640  }
5641}
5642var SchedulerComponent = class _SchedulerComponent {
5643  store = inject(MessengerStore);
5644  static \u0275fac = function SchedulerComponent_Factory(__ngFactoryType__) {
5645    return new (__ngFactoryType__ || _SchedulerComponent)();
5646  };
5647  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _SchedulerComponent, selectors: [["app-scheduler"]], decls: 9, vars: 4, consts: [["linkConfig", ""], [1, "size-full", "grid", "grid-rows-[1fr_auto]", 2, "--p-card-body-padding", "0.65rem 1.25rem", "--p-card-border-radius", "0.75rem"], [1, "relative"], [1, "absolute", "inset-6", 3, "post", "userType", "largeTitle"], [1, "absolute", "top-3.5", "right-6", "z-10"], [1, "pt-6", "pb-4", "px-5", "border-t", "border-grey-50"], [1, "text-sm", "font-semibold", "mb-3"], [1, "flex", "flex-col", "gap-3"]], template: function SchedulerComponent_Template(rf, ctx) {
5648    if (rf & 1) {
5649      \u0275\u0275elementStart(0, "section", 1)(1, "article", 2);
5650      \u0275\u0275element(2, "ui-preview", 3)(3, "app-link-preview-config", 4, 0);
5651      \u0275\u0275elementEnd();
5652      \u0275\u0275elementStart(5, "article", 5);
5653      \u0275\u0275conditionalCreate(6, SchedulerComponent_Conditional_6_Template, 7, 6);
5654      \u0275\u0275elementStart(7, "section");
5655      \u0275\u0275element(8, "app-publisher");
5656      \u0275\u0275elementEnd()()();
5657    }
5658    if (rf & 2) {
5659      const linkConfig_r2 = \u0275\u0275reference(4);
5660      \u0275\u0275advance(2);
5661      \u0275\u0275property("post", ctx.store.post())("userType", ctx.store.userType())("largeTitle", !linkConfig_r2.canShow());
5662      \u0275\u0275advance(4);
5663      \u0275\u0275conditional(!ctx.store.post().status.is.idea ? 6 : -1);
5664    }
5665  }, dependencies: [
5666    CommonModule,
5667    TranslatePipe,
5668    PreviewComponent,
5669    PublisherComponent,
5670    ProgrammerComponent,
5671    WithAiComponent,
5672    CyclicListComponent2,
5673    LinkPreviewConfigComponent
5674  ], encapsulation: 2 });
5675};
5676(() => {
5677  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(SchedulerComponent, [{
5678    type: Component,
5679    args: [{ selector: "app-scheduler", imports: [
5680      CommonModule,
5681      TranslatePipe,
5682      PreviewComponent,
5683      PublisherComponent,
5684      ProgrammerComponent,
5685      WithAiComponent,
5686      CyclicListComponent2,
5687      LinkPreviewConfigComponent
5688    ], template: `<section
5689  class="size-full grid grid-rows-[1fr_auto]"
5690  style="--p-card-body-padding: 0.65rem 1.25rem; --p-card-border-radius: 0.75rem"
5691>
5692  <article class="relative">
5693    <ui-preview
5694      [post]="store.post()"
5695      [userType]="store.userType()"
5696      [largeTitle]="!linkConfig.canShow()"
5697      class="absolute inset-6"
5698    />
5699    <app-link-preview-config #linkConfig class="absolute top-3.5 right-6 z-10" />
5700  </article>
5701
5702  <article class="pt-6 pb-4 px-5 border-t border-grey-50">
5703    @if (!store.post().status.is.idea) {
5704    <h3 class="text-sm font-semibold mb-3">{{ 'MESSENGER.WHEN_TO_PUBLISH' | translate }}</h3>
5705
5706    <section class="flex flex-col gap-3">
5707      @if (!store.isCyclicLocked()) {
5708      <app-programmer />
5709      } @if ((store.post().is.new || store.post().has.cyclic) && !store.personalized.active()) {
5710      <app-cyclic-list />
5711      } @if (!store.isCyclicLocked()) {
5712      <app-with-ai />
5713      }
5714    </section>
5715    }
5716
5717    <section>
5718      <app-publisher />
5719    </section>
5720  </article>
5721</section>
5722` }]
5723  }], null, null);
5724})();
5725(() => {
5726  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(SchedulerComponent, { className: "SchedulerComponent", filePath: "libs/socialgest/messenger/src/presenter/components/scheduler/scheduler.component.ts", lineNumber: 23 });
5727})();
5728
5729// libs/socialgest/messenger/src/presenter/components/campaign/campaign.component.ts
5730var _c09 = (a0) => ({ "w-0 h-0 overflow-hidden opacity-0": a0 });
5731var CampaignComponent = class _CampaignComponent {
5732  store = inject(MessengerStore);
5733  static \u0275fac = function CampaignComponent_Factory(__ngFactoryType__) {
5734    return new (__ngFactoryType__ || _CampaignComponent)();
5735  };
5736  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _CampaignComponent, selectors: [["app-campaign"]], decls: 3, vars: 4, consts: [["selectCampaign", ""], [1, "flex", "items-center", "justify-between"], ["mode", "actives", 3, "campaignChange", "value", "ngClass"]], template: function CampaignComponent_Template(rf, ctx) {
5737    if (rf & 1) {
5738      const _r1 = \u0275\u0275getCurrentView();
5739      \u0275\u0275elementStart(0, "article", 1)(1, "ui-select-campaign", 2, 0);
5740      \u0275\u0275listener("campaignChange", function CampaignComponent_Template_ui_select_campaign_campaignChange_1_listener($event) {
5741        \u0275\u0275restoreView(_r1);
5742        return \u0275\u0275resetView(ctx.store.post().set.campaign($event));
5743      });
5744      \u0275\u0275elementEnd()();
5745    }
5746    if (rf & 2) {
5747      const selectCampaign_r2 = \u0275\u0275reference(2);
5748      \u0275\u0275advance();
5749      \u0275\u0275property("value", ctx.store.post().campaign.id)("ngClass", \u0275\u0275pureFunction1(2, _c09, selectCampaign_r2.campaigns().length === 0));
5750    }
5751  }, dependencies: [CommonModule, NgClass, SelectCampaignComponent], encapsulation: 2 });
5752};
5753(() => {
5754  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CampaignComponent, [{
5755    type: Component,
5756    args: [{ selector: "app-campaign", imports: [CommonModule, SelectCampaignComponent], template: `<article class="flex items-center justify-between">
5757  <ui-select-campaign
5758    #selectCampaign
5759    (campaignChange)="store.post().set.campaign($event)"
5760    [value]="store.post().campaign.id"
5761    mode="actives"
5762    [ngClass]="{ 'w-0 h-0 overflow-hidden opacity-0': selectCampaign.campaigns().length === 0 }"
5763  />
5764</article>
5765` }]
5766  }], null, null);
5767})();
5768(() => {
5769  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(CampaignComponent, { className: "CampaignComponent", filePath: "libs/socialgest/messenger/src/presenter/components/campaign/campaign.component.ts", lineNumber: 11 });
5770})();
5771
5772// libs/socialgest/messenger/src/presenter/components/tab-list/tab-list.component.ts
5773var TabListComponent = class _TabListComponent extends BaseComponent {
5774  store = inject(MessengerStore);
5775  personalizedService = inject(MessengerPersonalizedService);
5776  userIconPipe = inject(UserIconPipe);
5777  isUploading = signal(false);
5778  userTypes = computed(() => {
5779    const disabled = this.store.personalized().active && this.isUploading();
5780    return this.store.post().userList.types.map((type) => ({
5781      ref: type,
5782      icon: this.userIconPipe.transform({ type }),
5783      isDisabled: disabled && type !== this.store.userType()
5784    }));
5785  });
5786  constructor() {
5787    super();
5788    this.bus.on(UploaderLoadingEvent).pipe(this.unsubscribe()).subscribe(({ isLoading }) => this.isUploading.set(isLoading));
5789    effect(() => {
5790      if (!this.userTypes().some((userType) => userType.ref === this.store.userType())) {
5791        const nextType = this.userTypes()[0]?.ref ?? UserType.NONE;
5792        this.store.withUserType(nextType);
5793        if (this.store.personalized().active) {
5794          this.personalizedService.loadTab(nextType);
5795        }
5796      }
5797    });
5798  }
5799  isSwitching = false;
5800  select(type) {
5801    if (this.isSwitching)
5802      return;
5803    this.isSwitching = true;
5804    if (this.store.personalized().active) {
5805      this.personalizedService.saveCurrentTab();
5806    }
5807    this.store.withUserType(type);
5808    if (this.store.personalized().active) {
5809      this.personalizedService.loadTab(type);
5810    }
5811    this.isSwitching = false;
5812  }
5813  static \u0275fac = function TabListComponent_Factory(__ngFactoryType__) {
5814    return new (__ngFactoryType__ || _TabListComponent)();
5815  };
5816  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _TabListComponent, selectors: [["app-tab-list"]], features: [\u0275\u0275ProvidersFeature([UserIconPipe]), \u0275\u0275InheritDefinitionFeature], decls: 2, vars: 2, consts: [[1, "h-11", "relative", 2, "--p-tabs-tabpanel-padding", "0 !important"], [3, "valueChange", "activeTab", "headers"]], template: function TabListComponent_Template(rf, ctx) {
5817    if (rf & 1) {
5818      \u0275\u0275elementStart(0, "section", 0)(1, "ui-tabs", 1);
5819      \u0275\u0275listener("valueChange", function TabListComponent_Template_ui_tabs_valueChange_1_listener($event) {
5820        return ctx.select($event);
5821      });
5822      \u0275\u0275elementEnd()();
5823    }
5824    if (rf & 2) {
5825      \u0275\u0275advance();
5826      \u0275\u0275property("activeTab", ctx.store.userType())("headers", ctx.userTypes());
5827    }
5828  }, dependencies: [CommonModule, TabsComponent], encapsulation: 2 });
5829};
5830(() => {
5831  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TabListComponent, [{
5832    type: Component,
5833    args: [{ selector: "app-tab-list", imports: [CommonModule, IconComponent, TabsComponent], providers: [UserIconPipe], template: '<section class="h-11 relative" style="--p-tabs-tabpanel-padding: 0 !important">\n  <ui-tabs (valueChange)="select($event)" [activeTab]="store.userType()" [headers]="userTypes()" />\n</section>\n' }]
5834  }], () => [], null);
5835})();
5836(() => {
5837  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(TabListComponent, { className: "TabListComponent", filePath: "libs/socialgest/messenger/src/presenter/components/tab-list/tab-list.component.ts", lineNumber: 14 });
5838})();
5839
5840// libs/socialgest/messenger/src/presenter/components/extras/__shared__/components/location/mappers/tiktok-location.mapper.ts
5841var TiktokLocationMapper2 = class {
5842  static toDomain(entities) {
5843    return entities.filter((entity) => entity.location_id && entity.location_name).map((entity) => ({
5844      id: entity.location_id,
5845      name: entity.location_name,
5846      address: entity.location_address || void 0,
5847      city: null,
5848      country: null,
5849      state: null,
5850      street: null
5851    }));
5852  }
5853};
5854
5855// libs/socialgest/messenger/src/presenter/components/extras/__shared__/components/location/services/location-error.service.ts
5856var MAP_ERRORS5 = {
5857  3: () => "GLOBAL.ERROR.PERMISSION_DENIED",
5858  504: () => "MESSENGER.ERROR.TIMEOUT",
5859  1010: () => "MESSENGER.ERROR.RATE_LIMIT",
5860  40001: () => "MESSENGER.LOCATION.ERROR.BUSINESS_ONLY",
5861  40105: () => "MESSENGER.LOCATION.ERROR.TOKEN_REVOKED"
5862};
5863var from3 = (response) => {
5864  return new Exception(MAP_ERRORS5[response.error?.meta?.code]?.(response) ?? "GLOBAL.ERROR.UNEXPECTED");
5865};
5866
5867// libs/socialgest/messenger/src/presenter/components/extras/__shared__/components/location/services/location.service.ts
5868var TIKTOK_SEARCH_QUERY_MAX = 100;
5869var LocationService2 = class _LocationService {
5870  http;
5871  constructor(http) {
5872    this.http = http;
5873  }
5874  search(placeName, userList) {
5875    if (userList.first.isTiktok)
5876      return this.searchTiktok(placeName, userList.first.id);
5877    return this.searchMeta(placeName, userList);
5878  }
5879  searchMeta(placeName, userList) {
5880    const usersParam = userList.first.id ? `&users[0]=${userList.first.id}` : "";
5881    const url = `${environment.apiUrlV1}placesTweet?placeName=${encodeURIComponent(placeName)}${usersParam}`;
5882    return this.http.get(url).pipe(map((response) => {
5883      const locations = response?.data?.info?.Fb?.data || response?.data?.info?.Ig?.data || [];
5884      return esm_exports.right(locations);
5885    }), catchError((err) => of(esm_exports.left(from3(err)))));
5886  }
5887  searchTiktok(placeName, userId) {
5888    const params = { search_query: placeName.slice(0, TIKTOK_SEARCH_QUERY_MAX) };
5889    return this.http.get(`${environment.apiUrlV1}tiktok_business/locations/${userId}`, { params }).pipe(map((response) => esm_exports.right(TiktokLocationMapper2.toDomain(response?.data?.locations ?? []))), catchError((err) => of(esm_exports.left(from3(err)))));
5890  }
5891  static \u0275fac = function LocationService_Factory(__ngFactoryType__) {
5892    return new (__ngFactoryType__ || _LocationService)(\u0275\u0275inject(HttpClient));
5893  };
5894  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _LocationService, factory: _LocationService.\u0275fac, providedIn: "root" });
5895};
5896(() => {
5897  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(LocationService2, [{
5898    type: Injectable,
5899    args: [{ providedIn: "root" }]
5900  }], () => [{ type: HttpClient }], null);
5901})();
5902
5903// libs/socialgest/messenger/src/presenter/components/extras/__shared__/components/location/location.component.ts
5904var _c010 = (a0, a1) => ({ label: a0, value: a1 });
5905function LocationComponent_Conditional_11_ng_template_1_Conditional_2_Template(rf, ctx) {
5906  if (rf & 1) {
5907    \u0275\u0275elementStart(0, "span", 14);
5908    \u0275\u0275text(1);
5909    \u0275\u0275elementEnd();
5910  }
5911  if (rf & 2) {
5912    const segment_r5 = \u0275\u0275nextContext().$implicit;
5913    \u0275\u0275advance();
5914    \u0275\u0275textInterpolate(segment_r5.address);
5915  }
5916}
5917function LocationComponent_Conditional_11_ng_template_1_Template(rf, ctx) {
5918  if (rf & 1) {
5919    \u0275\u0275elementStart(0, "span", 13);
5920    \u0275\u0275text(1);
5921    \u0275\u0275elementEnd();
5922    \u0275\u0275conditionalCreate(2, LocationComponent_Conditional_11_ng_template_1_Conditional_2_Template, 2, 1, "span", 14);
5923  }
5924  if (rf & 2) {
5925    const segment_r5 = ctx.$implicit;
5926    \u0275\u0275advance();
5927    \u0275\u0275textInterpolate(segment_r5.label);
5928    \u0275\u0275advance();
5929    \u0275\u0275conditional(segment_r5.address ? 2 : -1);
5930  }
5931}
5932function LocationComponent_Conditional_11_Template(rf, ctx) {
5933  if (rf & 1) {
5934    const _r3 = \u0275\u0275getCurrentView();
5935    \u0275\u0275elementStart(0, "ui-segment-list", 12);
5936    \u0275\u0275listener("valueChange", function LocationComponent_Conditional_11_Template_ui_segment_list_valueChange_0_listener($event) {
5937      \u0275\u0275restoreView(_r3);
5938      const ctx_r3 = \u0275\u0275nextContext();
5939      return \u0275\u0275resetView(ctx_r3.select($event));
5940    });
5941    \u0275\u0275template(1, LocationComponent_Conditional_11_ng_template_1_Template, 3, 2, "ng-template", null, 2, \u0275\u0275templateRefExtractor);
5942    \u0275\u0275elementEnd();
5943  }
5944  if (rf & 2) {
5945    const ctx_r3 = \u0275\u0275nextContext();
5946    const platformLocation_r6 = \u0275\u0275readContextLet(0);
5947    \u0275\u0275property("segments", ctx_r3.locations())("selected", \u0275\u0275pureFunction2(2, _c010, platformLocation_r6.name, platformLocation_r6.id));
5948  }
5949}
5950function LocationComponent_Conditional_12_Template(rf, ctx) {
5951  if (rf & 1) {
5952    \u0275\u0275elementStart(0, "section", 10);
5953    \u0275\u0275element(1, "ui-icon", 15);
5954    \u0275\u0275elementStart(2, "h3", 16);
5955    \u0275\u0275text(3);
5956    \u0275\u0275pipe(4, "translate");
5957    \u0275\u0275elementEnd()();
5958  }
5959  if (rf & 2) {
5960    \u0275\u0275advance(3);
5961    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 1, "MESSENGER.LOCATION.POST"));
5962  }
5963}
5964function LocationComponent_Conditional_13_Template(rf, ctx) {
5965  if (rf & 1) {
5966    \u0275\u0275element(0, "ui-empty-list", 11);
5967  }
5968  if (rf & 2) {
5969    const ctx_r3 = \u0275\u0275nextContext();
5970    const searchInput_r7 = \u0275\u0275reference(8);
5971    \u0275\u0275property("hasItems", true)("noResultsLabel", "GLOBAL.EMPTY.NO_RESULTS_LIST_TITLE")("noResultsDescription", "GLOBAL.EMPTY.NO_RESULTS_LIST_DESC")("isScreenView", false)("isLoading", ctx_r3.isLoading() || ctx_r3.lastSearchedTerm() !== searchInput_r7.value())("width", "100%")("height", "100%");
5972  }
5973}
5974var LocationComponent = class _LocationComponent {
5975  userType = input.required();
5976  userList = input.required();
5977  store = inject(MessengerStore);
5978  locationService = inject(LocationService2);
5979  isLoading = signal(false);
5980  locations = signal([]);
5981  defaultTerm = signal("");
5982  lastSearchedTerm = signal("");
5983  ngOnInit() {
5984    const location = this.store.post().options.for(this.userType()).location;
5985    this.defaultTerm.set(location.name);
5986    this.search(this.defaultTerm());
5987  }
5988  search(term) {
5989    if (!term.trim()) {
5990      this.locations.set([]);
5991      this.lastSearchedTerm.set("");
5992      return;
5993    }
5994    this.isLoading.set(true);
5995    this.locationService.search(term, this.userList()).subscribe({
5996      next: (result) => {
5997        result.mapRight((_) => this.locations.set(_.map(({ id, name, address }) => ({ label: name, value: id, address }))));
5998        result.mapLeft(() => this.locations.set([]));
5999        this.lastSearchedTerm.set(term);
6000        this.isLoading.set(false);
6001      },
6002      error: () => {
6003        this.locations.set([]);
6004        this.isLoading.set(false);
6005      },
6006      complete: () => {
6007        this.lastSearchedTerm.set(term);
6008        this.isLoading.set(false);
6009      }
6010    });
6011  }
6012  select(id) {
6013    const platformLocation = this.store.post().options.for(this.userType()).location;
6014    const location = this.locations().find(({ value }) => value === id);
6015    if (location) {
6016      platformLocation.set(location.value, location.label);
6017    } else {
6018      platformLocation.reset();
6019    }
6020  }
6021  static \u0275fac = function LocationComponent_Factory(__ngFactoryType__) {
6022    return new (__ngFactoryType__ || _LocationComponent)();
6023  };
6024  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _LocationComponent, selectors: [["app-location"]], inputs: { userType: [1, "userType"], userList: [1, "userList"] }, decls: 14, vars: 16, consts: [["popover", ""], ["searchInput", ""], ["item", ""], ["icon", "mapPin", 1, "curs
6024or-pointer", 3, "click", "variant", "severity", "tooltip", "tooltipPosition", "positionTop", "styleClass"], ["styleClass", "w-[19.5rem] -mt-5! no-gutter"], [1, "grid", "grid-rows-[auto_1fr]", "p-5"], [1, "flex", "flex-col", "gap-3", "mb-5"], ["size", "small", 3, "valueChange", "ngModel", "placeholder"], [1, "h-[15.5rem]", "overflow-y-auto", "p-1.5"], ["itemStyleClass", "min-h-9! rounded-md! border-grey-100 px-4! py-1.5! mb-1", 1, "segment-thin", 2, "--p-card-body-padding", "0", 3, "segments", "selected"], [1, "h-full", "flex", "flex-col", "justify-center", "items-center", "gap-2"], ["emptyTitleStyleClass", "text-md! px-0!", "emptyDescriptionStyleClass", "text-sm! px-0!", "emptyStyleClass", "gap-2!", "iconStyleClass", "size-16!", 3, "hasItems", "noResultsLabel", "noResultsDescription", "isScreenView", "isLoading", "width", "height"], ["itemStyleClass", "min-h-9! rounded-md! border-grey-100 px-4! py-1.5! mb-1", 1, "segment-thin", 2, "--p-card-body-padding", "0", 3, "valueChange", "segments", "selected"], [1, "block", "w-full", "font-display", "text-sm", "font-semibold", "truncate"], [1, "block", "w-full", "text-xs", "text-grey-400", "truncate"], ["name", "mapPin", "strokeWidth", "1", "styleClass", "text-grey-300 size-16"], [1, "font-medium", "text-grey-300"]], template: function LocationComponent_Template(rf, ctx) {
6025    if (rf & 1) {
6026      const _r1 = \u0275\u0275getCurrentView();
6027      \u0275\u0275declareLet(0);
6028      \u0275\u0275elementStart(1, "ui-button", 3);
6029      \u0275\u0275pipe(2, "translate");
6030      \u0275\u0275listener("click", function LocationComponent_Template_ui_button_click_1_listener($event) {
6031        \u0275\u0275restoreView(_r1);
6032        const popover_r2 = \u0275\u0275reference(4);
6033        return \u0275\u0275resetView(popover_r2.toggle($event));
6034      });
6035      \u0275\u0275elementEnd();
6036      \u0275\u0275elementStart(3, "ui-popover", 4, 0)(5, "article", 5)(6, "header", 6)(7, "ui-input-search", 7, 1);
6037      \u0275\u0275pipe(9, "translate");
6038      \u0275\u0275listener("valueChange", function LocationComponent_Template_ui_input_search_valueChange_7_listener($event) {
6039        \u0275\u0275restoreView(_r1);
6040        return \u0275\u0275resetView(ctx.search($event));
6041      });
6042      \u0275\u0275elementEnd()();
6043      \u0275\u0275elementStart(10, "section", 8);
6044      \u0275\u0275conditionalCreate(11, LocationComponent_Conditional_11_Template, 3, 5, "ui-segment-list", 9)(12, LocationComponent_Conditional_12_Template, 5, 3, "section", 10)(13, LocationComponent_Conditional_13_Template, 1, 7, "ui-empty-list", 11);
6045      \u0275\u0275elementEnd()()();
6046    }
6047    if (rf & 2) {
6048      const popover_r2 = \u0275\u0275reference(4);
6049      const platformLocation_r8 = \u0275\u0275storeLet(ctx.store.post().options.for(ctx.userType()).location);
6050      \u0275\u0275advance();
6051      \u0275\u0275property("styleClass", \u0275\u0275interpolate2("\n  ", popover_r2.isOpen() && "bg-grey-50!", "\n  ", platformLocation_r8.isPresent && " bg-secondary-50!"))("variant", platformLocation_r8.isPresent ? "outlined" : void 0)("severity", platformLocation_r8.isPresent ? "secondary" : "contrast")("tooltip", \u0275\u0275pipeBind1(2, 12, "MESSENGER.LOCATION.TITLE"))("tooltipPosition", "top")("positionTop", -10);
6052      \u0275\u0275advance(6);
6053      \u0275\u0275property("ngModel", ctx.defaultTerm())("placeholder", \u0275\u0275pipeBind1(9, 14, "MESSENGER.LOCATION.SEARCH"));
6054      \u0275\u0275advance(4);
6055      \u0275\u0275conditional(!ctx.isLoading() && ctx.locations().length > 0 ? 11 : !ctx.isLoading() && ctx.lastSearchedTerm() === "" ? 12 : 13);
6056    }
6057  }, dependencies: [
6058    CommonModule,
6059    FormsModule,
6060    NgControlStatus,
6061    NgModel,
6062    TranslatePipe,
6063    SegmentListComponent,
6064    IconComponent,
6065    PopoverComponent,
6066    InputSearchComponent,
6067    ButtonComponent,
6068    EmptyListComponent,
6069    TooltipDirective
6070  ], encapsulation: 2 });
6071};
6072(() => {
6073  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(LocationComponent, [{
6074    type: Component,
6075    args: [{ selector: "app-location", imports: [
6076      CommonModule,
6077      FormsModule,
6078      TranslatePipe,
6079      SegmentListComponent,
6080      IconComponent,
6081      PopoverComponent,
6082      InputSearchComponent,
6083      ButtonComponent,
6084      EmptyListComponent,
6085      TooltipDirective
6086    ], template: `@let platformLocation = $any(store.post().options.for(userType())).location;
6087
6088<ui-button
6089  (click)="popover.toggle($event)"
6090  icon="mapPin"
6091  [variant]="platformLocation.isPresent ? 'outlined' : undefined"
6092  [severity]="platformLocation.isPresent ? 'secondary' : 'contrast'"
6093  [tooltip]="'MESSENGER.LOCATION.TITLE' | translate"
6094  [tooltipPosition]="'top'"
6095  [positionTop]="-10"
6096  class="cursor-pointer"
6097  styleClass="
6098  {{ popover.isOpen() && 'bg-grey-50!' }}
6099  {{ platformLocation.isPresent && ' bg-secondary-50!' }}"
6100/>
6101
6102<ui-popover #popover styleClass="w-[19.5rem] -mt-5! no-gutter">
6103  <article class="grid grid-rows-[auto_1fr] p-5">
6104    <header class="flex flex-col gap-3 mb-5">
6105      <ui-input-search
6106        #searchInput
6107        [ngModel]="defaultTerm()"
6108        (valueChange)="search($event)"
6109        [placeholder]="'MESSENGER.LOCATION.SEARCH' | translate"
6110        size="small"
6111      />
6112    </header>
6113
6114    <section class="h-[15.5rem] overflow-y-auto p-1.5">
6115      @if(!isLoading() && locations().length > 0) {
6116
6117      <ui-segment-list
6118        (valueChange)="select($event)"
6119        [segments]="locations()"
6120        [selected]="{ label: platformLocation.name, value: platformLocation.id }"
6121        itemStyleClass="min-h-9! rounded-md! border-grey-100 px-4! py-1.5! mb-1"
6122        class="segment-thin"
6123        style="--p-card-body-padding: 0"
6124      >
6125        <ng-template #item let-segment>
6126          <span class="block w-full font-display text-sm font-semibold truncate">{{ segment.label }}</span>
6127          @if (segment.address) {
6128          <span class="block w-full text-xs text-grey-400 truncate">{{ segment.address }}</span>
6129          }
6130        </ng-template>
6131      </ui-segment-list>
6132
6133      }@else if(!isLoading() && lastSearchedTerm() === ''){
6134
6135      <section class="h-full flex flex-col justify-center items-center gap-2">
6136        <ui-icon name="mapPin" strokeWidth="1" styleClass="text-grey-300 size-16" />
6137        <h3 class="font-medium text-grey-300">{{ 'MESSENGER.LOCATION.POST' | translate }}</h3>
6138      </section>
6139
6140      } @else {
6141
6142      <ui-empty-list
6143        [hasItems]="true"
6144        [noResultsLabel]="'GLOBAL.EMPTY.NO_RESULTS_LIST_TITLE'"
6145        [noResultsDescription]="'GLOBAL.EMPTY.NO_RESULTS_LIST_DESC'"
6146        [isScreenView]="false"
6147        [isLoading]="isLoading() || lastSearchedTerm() !== searchInput.value()"
6148        [width]="'100%'"
6149        [height]="'100%'"
6150        emptyTitleStyleClass="text-md! px-0!"
6151        emptyDescriptionStyleClass="text-sm! px-0!"
6152        emptyStyleClass="gap-2!"
6153        iconStyleClass="size-16!"
6154      />
6155
6156      }
6157    </section>
6158  </article>
6159</ui-popover>
6160` }]
6161  }], null, null);
6162})();
6163(() => {
6164  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(LocationComponent, { className: "LocationComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/__shared__/components/location/location.component.ts", lineNumber: 27 });
6165})();
6166
6167// libs/socialgest/messenger/src/presenter/components/extras/__shared__/components/first-comment/first-comment.component.ts
6168var FirstCommentComponent = class _FirstCommentComponent {
6169  MAX_LENGTH = 2e3;
6170  userType = input.required();
6171  userList = input.required();
6172  comment = new FormControl("", [Validators.maxLength(this.MAX_LENGTH)]);
6173  store = inject(MessengerStore);
6174  ngOnInit() {
6175    const firstComment = this.store.post().options.for(this.userType()).firstComment;
6176    this.comment.setValue(firstComment.value);
6177  }
6178  confirm() {
6179    if (this.comment.invalid)
6180      return;
6181    this.store.post().options.for(this.userType()).firstComment.set(this.comment.value);
6182  }
6183  static \u0275fac = function FirstCommentComponent_Factory(__ngFactoryType__) {
6184    return new (__ngFactoryType__ || _FirstCommentComponent)();
6185  };
6186  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _FirstCommentComponent, selectors: [["app-first-comment"]], inputs: { userType: [1, "userType"], userList: [1, "userList"] }, decls: 18, vars: 20, consts: [["popover", ""], ["icon", "messageSquare", 1, "cursor-pointer", 3, "click", "variant", "severity", "tooltip", "tooltipPosition", "positionTop", "styleClass"], ["styleClass", "w-[22rem] -mt-5! no-gutter"], [1, "h-[21rem]", "grid", "grid-rows-[auto_1fr_auto]", "p-5", "gap-2"], [1, "font-semibold"], [1, "size-full", "relative"], ["styleClass", "size-full rounded-base", 3, "formControl", "placeholder"], [1, "absolute", "bottom-2", "right-2"], [1, "text-grey-300", "text-sm", "font-sans", "md:ml-4"], [1, "flex", "items-center", "justify-end", "gap-3", "mt-2"], ["label", "GLOBAL.CANCEL", "severity", "contrast", 3, "click"], ["label", "GLOBAL.CONFIRM", "severity", "secondary", 3, "click", "disabled"]], template: function FirstCommentComponent_Template(rf, ctx) {
6187    if (rf & 1) {
6188      const _r1 = \u0275\u0275getCurrentView();
6189      \u0275\u0275elementStart(0, "ui-button", 1);
6190      \u0275\u0275pipe(1, "translate");
6191      \u0275\u0275listener("click", function FirstCommentComponent_Template_ui_button_click_0_listener($event) {
6192        \u0275\u0275restoreView(_r1);
6193        const popover_r2 = \u0275\u0275reference(3);
6194        return \u0275\u0275resetView(popover_r2.toggle($event));
6195      });
6196      \u0275\u0275elementEnd();
6197      \u0275\u0275elementStart(2, "ui-popover", 2, 0)(4, "article", 3)(5, "header")(6, "h3", 4);
6198      \u0275\u0275text(7);
6199      \u0275\u0275pipe(8, "translate");
6200      \u0275\u0275elementEnd()();
6201      \u0275\u0275elementStart(9, "section", 5);
6202      \u0275\u0275element(10, "ui-textarea", 6);
6203      \u0275\u0275pipe(11, "translate");
6204      \u0275\u0275elementStart(12, "footer", 7)(13, "span", 8);
6205      \u0275\u0275text(14);
6206      \u0275\u0275elementEnd()()();
6207      \u0275\u0275elementStart(15, "footer", 9)(16, "ui-button", 10);
6208      \u0275\u0275listener("click", function FirstCommentComponent_Template_ui_button_click_16_listener() {
6209        \u0275\u0275restoreView(_r1);
6210        const popover_r2 = \u0275\u0275reference(3);
6211        return \u0275\u0275resetView(popover_r2.hide());
6212      });
6213      \u0275\u0275elementEnd();
6214      \u0275\u0275elementStart(17, "ui-button", 11);
6215      \u0275\u0275listener("click", function FirstCommentComponent_Template_ui_button_click_17_listener() {
6216        \u0275\u0275restoreView(_r1);
6217        const popover_r2 = \u0275\u0275reference(3);
6218        ctx.confirm();
6219        return \u0275\u0275resetView(popover_r2.hide());
6220      });
6221      \u0275\u0275elementEnd()()()();
6222    }
6223    if (rf & 2) {
6224      const popover_r2 = \u0275\u0275reference(3);
6225      const firstComment_r3 = ctx.store.post().options.for(ctx.userType()).firstComment;
6226      \u0275\u0275property("styleClass", \u0275\u0275interpolate2("\n  ", popover_r2.isOpen() && "bg-grey-50!", "\n  ", firstComment_r3.isPresent && " bg-secondary-50!"))("variant", firstComment_r3.isPresent ? "outlined" : void 0)("severity", firstComment_r3.isPresent ? "secondary" : "contrast")("tooltip", \u0275\u0275pipeBind1(1, 14, "MESSENGER.FIRST_COMMENT.TITLE"))("tooltipPosition", "top")("positionTop", -10);
6227      \u0275\u0275advance(7);
6228      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(8, 16, "MESSENGER.FIRST_COMMENT.TITLE"));
6229      \u0275\u0275advance(3);
6230      \u0275\u0275property("formControl", ctx.comment)("placeholder", \u0275\u0275pipeBind1(11, 18, "MESSENGER.FIRST_COMMENT.WRITE"));
6231      \u0275\u0275advance(4);
6232      \u0275\u0275textInterpolate2("", (ctx.comment.value == null ? null : ctx.comment.value.length) || 0, "/", ctx.MAX_LENGTH);
6233      \u0275\u0275advance(3);
6234      \u0275\u0275property("disabled", ctx.comment.invalid);
6235    }
6236  }, dependencies: [
6237    CommonModule,
6238    ReactiveFormsModule,
6239    NgControlStatus,
6240    FormControlDirective,
6241    TranslatePipe,
6242    PopoverComponent,
6243    ButtonComponent,
6244    TextareaComponent,
6245    TooltipDirective
6246  ], encapsulation: 2 });
6247};
6248(() => {
6249  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(FirstCommentComponent, [{
6250    type: Component,
6251    args: [{ selector: "app-first-comment", imports: [
6252      CommonModule,
6253      ReactiveFormsModule,
6254      TranslatePipe,
6255      IconComponent,
6256      PopoverComponent,
6257      ButtonComponent,
6258      EmojiPickerComponent,
6259      TextareaComponent,
6260      TooltipDirective
6261    ], template: `@let firstComment = $any(store.post().options.for(userType())).firstComment;
6262
6263<ui-button
6264  (click)="popover.toggle($event)"
6265  icon="messageSquare"
6266  [variant]="firstComment.isPresent ? 'outlined' : undefined"
6267  [severity]="firstComment.isPresent ? 'secondary' : 'contrast'"
6268  [tooltip]="'MESSENGER.FIRST_COMMENT.TITLE' | translate"
6269  [tooltipPosition]="'top'"
6270  [positionTop]="-10"
6271  class="cursor-pointer"
6272  styleClass="
6273  {{ popover.isOpen() && 'bg-grey-50!' }}
6274  {{ firstComment.isPresent && ' bg-secondary-50!' }}"
6275/>
6276
6277<ui-popover #popover styleClass="w-[22rem] -mt-5! no-gutter">
6278  <article class="h-[21rem] grid grid-rows-[auto_1fr_auto] p-5 gap-2">
6279    <header>
6280      <h3 class="font-semibold">{{ 'MESSENGER.FIRST_COMMENT.TITLE' | translate }}</h3>
6281    </header>
6282
6283    <section class="size-full relative">
6284      <ui-textarea
6285        [formControl]="comment"
6286        [placeholder]="'MESSENGER.FIRST_COMMENT.WRITE' | translate"
6287        styleClass="size-full rounded-base"
6288      />
6289
6290      <footer class="absolute bottom-2 right-2">
6291        <span class="text-grey-300 text-sm font-sans md:ml-4">{{ comment.value?.length || 0 }}/{{ MAX_LENGTH }}</span>
6292      </footer>
6293    </section>
6294
6295    <footer class="flex items-center justify-end gap-3 mt-2">
6296      <ui-button (click)="popover.hide()" label="GLOBAL.CANCEL" severity="contrast" />
6297      <ui-button
6298        (click)="confirm(); popover.hide()"
6299        label="GLOBAL.CONFIRM"
6300        [disabled]="comment.invalid"
6301        severity="secondary"
6302      />
6303    </footer>
6304  </article>
6305</ui-popover>
6306` }]
6307  }], null, null);
6308})();
6309(() => {
6310  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(FirstCommentComponent, { className: "FirstCommentComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/__shared__/components/first-comment/first-comment.component.ts", lineNumber: 23 });
6311})();
6312
6313// libs/socialgest/messenger/src/presenter/components/extras/__shared__/components/mention/mention.component.ts
6314var _c011 = ["popover"];
6315var _c16 = ["mentionBtn"];
6316var _forTrack0 = ($index, $item) => $item.id;
6317function MentionComponent_Conditional_6_Template(rf, ctx) {
6318  if (rf & 1) {
6319    \u0275\u0275element(0, "div", 5);
6320  }
6321  if (rf & 2) {
6322    \u0275\u0275property("skeleton", true);
6323  }
6324}
6325function MentionComponent_Conditional_7_For_2_Template(rf, ctx) {
6326  if (rf & 1) {
6327    const _r2 = \u0275\u0275getCurrentView();
6328    \u0275\u0275elementStart(0, "li")(1, "button", 8);
6329    \u0275\u0275listener("click", function MentionComponent_Conditional_7_For_2_Template_button_click_1_listener() {
6330      const mention_r3 = \u0275\u0275restoreView(_r2).$implicit;
6331      const ctx_r3 = \u0275\u0275nextContext(2);
6332      return \u0275\u0275resetView(ctx_r3.selectMention(mention_r3));
6333    });
6334    \u0275\u0275element(2, "ui-avatar", 9);
6335    \u0275\u0275elementStart(3, "span", 10);
6336    \u0275\u0275text(4);
6337    \u0275\u0275elementEnd()()();
6338  }
6339  if (rf & 2) {
6340    const mention_r3 = ctx.$implicit;
6341    \u0275\u0275advance(2);
6342    \u0275\u0275property("image", mention_r3.photo)("label", mention_r3.name);
6343    \u0275\u0275advance(2);
6344    \u0275\u0275textInterpolate(mention_r3.name);
6345  }
6346}
6347function MentionComponent_Conditional_7_Template(rf, ctx) {
6348  if (rf & 1) {
6349    \u0275\u0275elementStart(0, "ul", 6);
6350    \u0275\u0275repeaterCreate(1, MentionComponent_Conditional_7_For_2_Template, 5, 3, "li", null, _forTrack0);
6351    \u0275\u0275elementEnd();
6352  }
6353  if (rf & 2) {
6354    const ctx_r3 = \u0275\u0275nextContext();
6355    \u0275\u0275advance();
6356    \u0275\u0275repeater(ctx_r3.results());
6357  }
6358}
6359function MentionComponent_Conditional_8_Template(rf, ctx) {
6360  if (rf & 1) {
6361    \u0275\u0275element(0, "ui-empty-list", 7);
6362  }
6363  if (rf & 2) {
6364    \u0275\u0275property("hasItems", true)("noResultsLabel", "GLOBAL.EMPTY.NO_RESULTS_LIST_TITLE")("noResultsDescription", "GLOBAL.EMPTY.NO_RESULTS_LIST_DESC")("isScreenView", false)("isLoading", false)("width", "100%")("height", "100%");
6365  }
6366}
6367var MentionComponent = class _MentionComponent {
6368  userType = input.required();
6369  store = inject(MessengerStore);
6370  mentionSearchService = inject(MentionSearchService);
6371  popover = viewChild("popover");
6372  mentionBtnRef = viewChild("mentionBtn", { read: ElementRef });
6373  isLoading = signal(false);
6374  results = signal([]);
6375  lastMessage = "";
6376  debounceTimer = null;
6377  currentSearchMatch = null;
6378  isActive = computed(() => this.store.isMention().activeForCurrentUser);
6379  constructor() {
6380    effect(() => {
6381      const message = this.store.post().message.value;
6382      if (!this.isActive())
6383        return;
6384      this.syncMentions(message);
6385      if (message === this.lastMessage)
6386        return;
6387      this.lastMessage = message;
6388      if (this.debounceTimer)
6389        clearTimeout(this.debounceTimer);
6390      this.debounceTimer = setTimeout(() => this.detectMention(message), 800);
6391    });
6392  }
6393  ngOnInit() {
6394    const options = this.store.post().options.for(this.userType());
6395    if (options.mentionList?.isPresent) {
6396      this.toggle();
6397    }
6398  }
6399  syncMentions(message) {
6400    const mentionList = this.store.post().options.for(this.userType()).mentionList;
6401    if (!mentionList?.isPresent)
6402      return;
6403    const toRemove = mentionList.items.filter((m) => !message.includes(`@${m.name}`));
6404    toRemove.forEach((m) => mentionList.remove(m.id));
6405  }
6406  toggle() {
6407    this.store.toggleMention(this.userType());
6408    if (!this.isActive()) {
6409      this.results.set([]);
6410      this.popover()?.hide();
6411    }
6412  }
6413  detectMention(message) {
6414    const matches = message.match(/@(?![^<]*<\/a>)[\w\s:\/.\-_&ñÑáéíóúÁÉÍÓÚüÜ]+/g);
6415    if (!matches) {
6416      this.results.set([]);
6417      this.isLoading.set(false);
6418      return;
6419    }
6420    const mentionList = this.store.post().options.for(this.userType()).mentionList;
6421    for (const match of matches) {
6422      const term = match.split("\n")[0].trim();
6423      if (term.length < 2)
6424        continue;
6425      const cleanTerm = term.substring(1);
6426      if (mentionList?.items.some((m) => cleanTerm.startsWith(m.name)))
6427        continue;
6428      this.currentSearchMatch = match;
6429      this.search(cleanTerm);
6430      return;
6431    }
6432    this.results.set([]);
6433    this.isLoading.set(false);
6434  }
6435  showPopover() {
6436    const target = this.mentionBtnRef()?.nativeElement;
6437    if (!target || this.popover()?.isOpen())
6438      return;
6439    this.popover()?.show(new Event("click"), target);
6440  }
6441  search(term) {
6442    const userList = this.store.post().userList;
6443    this.isLoading.set(true);
6444    this.results.set([]);
6445    this.showPopover();
6446    this.mentionSearchService.search(term, userList, this.userType()).subscribe({
6447      next: (result) => {
6448        result.mapRight((mentions) => {
6449          this.results.set(mentions);
6450        });
6451        result.mapLeft(() => this.results.set([]));
6452        this.isLoading.set(false);
6453      },
6454      error: () => {
6455        this.results.set([]);
6456        this.isLoading.set(false);
6457      }
6458    });
6459  }
6460  selectMention(mention) {
6461    const message = this.store.post().message.value;
6462    if (this.currentSearchMatch) {
6463      const matchIndex = message.indexOf(this.currentSearchMatch);
6464      if (matchIndex !== -1) {
6465        const newMessage = message.substring(0, matchIndex) + `@${mention.name} ` + message.substring(matchIndex + this.currentSearchMatch.length);
6466        this.store.post().set.message(newMessage);
6467      }
6468    }
6469    const options = this.store.post().options.for(this.userType());
6470    options.mentionList.insert({ id: mention.id, name: mention.name, photo: mention.photo });
6471    this.store.refresh();
6472    this.results.set([]);
6473    this.isLoading.set(true);
6474    this.currentSearchMatch = null;
6475    this.popover()?.hide();
6476    setTimeout(() => {
6477      this.showPopover();
6478      this.detectMention(this.store.post().message.value);
6479    }, 150);
6480  }
6481  static \u0275fac = function MentionComponent_Factory(__ngFactoryType__) {
6482    return new (__ngFactoryType__ || _MentionComponent)();
6483  };
6484  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _MentionComponent, selectors: [["app-mention"]], viewQuery: function MentionComponent_Query(rf, ctx) {
6485    if (rf & 1) {
6486      \u0275\u0275viewQuerySignal(ctx.popover, _c011, 5);
6487      \u0275\u0275viewQuerySignal(ctx.mentionBtnRef, _c16, 5, ElementRef);
6488    }
6489    if (rf & 2) {
6490      \u0275\u0275queryAdvance(2);
6491    }
6492  }, inputs: { userType: [1, "userType"] }, decls: 9, vars: 10, consts: [["mentionBtn", ""], ["popover", ""], ["icon", "atSign", 1, "curs
6492or-pointer", 3, "click", "variant", "severity", "tooltip", "tooltipPosition", "positionTop", "styleClass"], ["styleClass", "size-[18rem] -mt-5! no-gutter overflow-hidden"], [1, "max-h-[18rem]", "overflow-y-auto", "p-3"], ["width", "16.5rem", "height", "16.5rem", "skeletonClass", "rounded-lg", 3, "skeleton"], [1, "flex", "flex-col", "gap-1"], ["emptyTitleStyleClass", "text-md! px-0!", "emptyDescriptionStyleClass", "text-sm! px-0!", "emptyStyleClass", "gap-2!", "iconStyleClass", "size-16!", 1, "mt-12", 3, "hasItems", "noResultsLabel", "noResultsDescription", "isScreenView", "isLoading", "width", "height"], [1, "w-full", "flex", "items-center", "gap-3", "px-3", "py-2", "rounded-lg", "cursor-pointer", "hover:bg-grey-50", "transition-colors", 3, "click"], ["styleClass", "size-8!", 3, "image", "label"], [1, "text-sm", "font-semibold", "truncate"]], template: function MentionComponent_Template(rf, ctx) {
6493    if (rf & 1) {
6494      const _r1 = \u0275\u0275getCurrentView();
6495      \u0275\u0275elementStart(0, "ui-button", 2, 0);
6496      \u0275\u0275pipe(2, "translate");
6497      \u0275\u0275listener("click", function MentionComponent_Template_ui_button_click_0_listener() {
6498        \u0275\u0275restoreView(_r1);
6499        return \u0275\u0275resetView(ctx.toggle());
6500      });
6501      \u0275\u0275elementEnd();
6502      \u0275\u0275elementStart(3, "ui-popover", 3, 1)(5, "article", 4);
6503      \u0275\u0275conditionalCreate(6, MentionComponent_Conditional_6_Template, 1, 1, "div", 5)(7, MentionComponent_Conditional_7_Template, 3, 0, "ul", 6)(8, MentionComponent_Conditional_8_Template, 1, 7, "ui-empty-list", 7);
6504      \u0275\u0275elementEnd()();
6505    }
6506    if (rf & 2) {
6507      \u0275\u0275property("styleClass", \u0275\u0275interpolate(ctx.isActive() && "bg-secondary-50!"))("variant", ctx.isActive() ? "outlined" : void 0)("severity", ctx.isActive() ? "secondary" : "contrast")("tooltip", \u0275\u0275pipeBind1(2, 8, "MESSENGER.MENTION.TITLE"))("tooltipPosition", "top")("positionTop", -10);
6508      \u0275\u0275advance(6);
6509      \u0275\u0275conditional(ctx.isLoading() ? 6 : ctx.results().length > 0 ? 7 : 8);
6510    }
6511  }, dependencies: [
6512    CommonModule,
6513    TranslatePipe,
6514    PopoverComponent,
6515    ButtonComponent,
6516    TooltipDirective,
6517    AvatarComponent,
6518    SkeletonDirective,
6519    EmptyListComponent
6520  ], encapsulation: 2 });
6521};
6522(() => {
6523  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MentionComponent, [{
6524    type: Component,
6525    args: [{ selector: "app-mention", imports: [
6526      CommonModule,
6527      TranslatePipe,
6528      PopoverComponent,
6529      ButtonComponent,
6530      TooltipDirective,
6531      AvatarComponent,
6532      IconComponent,
6533      SkeletonDirective,
6534      EmptyListComponent
6535    ], template: `<ui-button
6536  #mentionBtn
6537  (click)="toggle()"
6538  icon="atSign"
6539  [variant]="isActive() ? 'outlined' : undefined"
6540  [severity]="isActive() ? 'secondary' : 'contrast'"
6541  [tooltip]="'MESSENGER.MENTION.TITLE' | translate"
6542  [tooltipPosition]="'top'"
6543  [positionTop]="-10"
6544  class="cursor-pointer"
6545  styleClass="{{ isActive() && 'bg-secondary-50!' }}"
6546/>
6547
6548<ui-popover #popover styleClass="size-[18rem] -mt-5! no-gutter overflow-hidden">
6549  <article class="max-h-[18rem] overflow-y-auto p-3">
6550    @if (isLoading()) {
6551    <div [skeleton]="true" width="16.5rem" height="16.5rem" skeletonClass="rounded-lg"></div>
6552    } @else if (results().length > 0) {
6553    <ul class="flex flex-col gap-1">
6554      @for (mention of results(); track mention.id) {
6555      <li>
6556        <button
6557          (click)="selectMention(mention)"
6558          class="w-full flex items-center gap-3 px-3 py-2 rounded-lg cursor-pointer hover:bg-grey-50 transition-colors"
6559        >
6560          <ui-avatar [image]="mention.photo" [label]="mention.name" styleClass="size-8!" />
6561          <span class="text-sm font-semibold truncate">{{ mention.name }}</span>
6562        </button>
6563      </li>
6564      }
6565    </ul>
6566    } @else {
6567    <ui-empty-list
6568      [hasItems]="true"
6569      [noResultsLabel]="'GLOBAL.EMPTY.NO_RESULTS_LIST_TITLE'"
6570      [noResultsDescription]="'GLOBAL.EMPTY.NO_RESULTS_LIST_DESC'"
6571      [isScreenView]="false"
6572      [isLoading]="false"
6573      [width]="'100%'"
6574      [height]="'100%'"
6575      emptyTitleStyleClass="text-md! px-0!"
6576      emptyDescriptionStyleClass="text-sm! px-0!"
6577      emptyStyleClass="gap-2!"
6578      iconStyleClass="size-16!"
6579      class="mt-12"
6580    />
6581    }
6582  </article>
6583</ui-popover>
6584` }]
6585  }], () => [], null);
6586})();
6587(() => {
6588  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(MentionComponent, { className: "MentionComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/__shared__/components/mention/mention.component.ts", lineNumber: 24 });
6589})();
6590
6591// libs/socialgest/messenger/src/presenter/components/extras/__shared__/components/publication-type/publication-type.component.ts
6592function PublicationTypeComponent_ng_template_5_Template(rf, ctx) {
6593  if (rf & 1) {
6594    \u0275\u0275elementStart(0, "div", 4)(1, "h3");
6595    \u0275\u0275text(2);
6596    \u0275\u0275pipe(3, "translate");
6597    \u0275\u0275elementEnd()();
6598  }
6599  if (rf & 2) {
6600    const segment_r2 = ctx.$implicit;
6601    const active_r3 = ctx.active;
6602    \u0275\u0275advance();
6603    \u0275\u0275classMap(\u0275\u0275interpolate1("text-sm font-semibold ", active_r3 ? "text-secondary-500!" : "text-grey-300"));
6604    \u0275\u0275advance();
6605    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(3, 4, segment_r2.title), " ");
6606  }
6607}
6608var PublicationTypeComponent = class _PublicationTypeComponent {
6609  platform = input.required();
6610  store = inject(MessengerStore);
6611  isCyclicList = computed(() => this.store.isCyclicList());
6612  segments = computed(() => {
6613    const isCyclic = this.isCyclicList();
6614    const base = this.platform() === "facebook" ? [
6615      { title: "POSTS.SHORT_TITLE", value: PublicationType.FEED },
6616      { title: "POSTS.REEL", value: PublicationType.REEL },
6617      { title: "POSTS.STORY", value: PublicationType.STORY }
6618    ] : [
6619      { title: "POSTS.SHORT_TITLE", value: PublicationType.FEED },
6620      { title: "POSTS.STORY", value: PublicationType.STORY }
6621    ];
6622    return isCyclic && this.platform() === "instagram" ? base.map((s) => __spreadProps(__spreadValues({}, s), { disabled: s.value !== PublicationType.STORY })) : base;
6623  });
6624  ngOnInit() {
6625    if (this.store.isCyclicList() && this.platform() === "instagram") {
6626      this.store.post().to.instagram.story();
6627      return;
6628    }
6629    if (this.platform() === "instagram" && this.store.post().is.instagram.reel) {
6630      this.store.post().to.instagram.feed();
6631    }
6632  }
6633  static \u0275fac = function PublicationTypeComponent_Factory(__ngFactoryType__) {
6634    return new (__ngFactoryType__ || _PublicationTypeComponent)();
6635  };
6636  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _PublicationTypeComponent, selectors: [["app-publication-type"]], inputs: { platform: [1, "platform"] }, decls: 7, vars: 5, consts: [["item", ""], [1, "flex", "flex-col", "gap-4"], [1, "text-sm", "font-semibold"], ["mode", "radio", "itemStyleClass", "border-none!", "styleClass", "flex-row! gap-6! px-2", 1, "segment-thin", 2, "--p-card-body-padding", "0", "--p-card-border-radius", "var(--radius-base)", 3, "ngModelChange", "ngModel", "segments"], [1, "h-[1.8rem]", "w-[3.2rem]", "flex", "items-center", "justify-center"]], template: function PublicationTypeComponent_Template(rf, ctx) {
6637    if (rf & 1) {
6638      const _r1 = \u0275\u0275getCurrentView();
6639      \u0275\u0275elementStart(0, "div", 1)(1, "h3", 2);
6640      \u0275\u0275text(2);
6641      \u0275\u0275pipe(3, "translate");
6642      \u0275\u0275elementEnd();
6643      \u0275\u0275elementStart(4, "ui-segment-list", 3);
6644      \u0275\u0275twoWayListener("ngModelChange", function PublicationTypeComponent_Template_ui_segment_list_ngModelChange_4_listener($event) {
6645        \u0275\u0275restoreView(_r1);
6646        \u0275\u0275twoWayBindingSet(ctx.store.post().publisher.publicationType[ctx.platform()], $event) || (ctx.store.post().publisher.publicationType[ctx.platform()] = $event);
6647        return \u0275\u0275resetView($event);
6648      });
6649      \u0275\u0275listener("ngModelChange", function PublicationTypeComponent_Template_ui_segment_list_ngModelChange_4_listener() {
6650        \u0275\u0275restoreView(_r1);
6651        return \u0275\u0275resetView(ctx.store.refresh());
6652      });
6653      \u0275\u0275template(5, PublicationTypeComponent_ng_template_5_Template, 4, 6, "ng-template", null, 0, \u0275\u0275templateRefExtractor);
6654      \u0275\u0275elementEnd()();
6655    }
6656    if (rf & 2) {
6657      \u0275\u0275advance(2);
6658      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(3, 3, "GLOBAL.CONTENT_TYPE"));
6659      \u0275\u0275advance(2);
6660      \u0275\u0275twoWayProperty("ngModel", ctx.store.post().publisher.publicationType[ctx.platform()]);
6661      \u0275\u0275property("segments", ctx.segments());
6662    }
6663  }, dependencies: [CommonModule, FormsModule, NgControlStatus, NgModel, TranslatePipe, SegmentListComponent], encapsulation: 2 });
6664};
6665(() => {
6666  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PublicationTypeComponent, [{
6667    type: Component,
6668    args: [{ selector: "app-publication-type", imports: [CommonModule, FormsModule, TranslatePipe, SegmentListComponent], template: `<div class="flex flex-col gap-4">
6669  <h3 class="text-sm font-semibold">{{ 'GLOBAL.CONTENT_TYPE' | translate }}</h3>
6670
6671  <ui-segment-list
6672    [(ngModel)]="store.post().publisher.publicationType[platform()]"
6673    (ngModelChange)="store.refresh()"
6674    [segments]="segments()"
6675    mode="radio"
6676    itemStyleClass="border-none!"
6677    styleClass="flex-row! gap-6! px-2"
6678    class="segment-thin"
6679    style="--p-card-body-padding: 0; --p-card-border-radius: var(--radius-base)"
6680  >
6681    <ng-template #item let-segment let-active="active">
6682      <div class="h-[1.8rem] w-[3.2rem] flex items-center justify-center">
6683        <h3 class="text-sm font-semibold {{ active ? 'text-secondary-500!' : 'text-grey-300' }}">
6684          {{ segment.title | translate }}
6685        </h3>
6686      </div>
6687    </ng-template>
6688  </ui-segment-list>
6689</div>
6690` }]
6691  }], null, null);
6692})();
6693(() => {
6694  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(PublicationTypeComponent, { className: "PublicationTypeComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/__shared__/components/publication-type/publication-type.component.ts", lineNumber: 13 });
6695})();
6696
6697// libs/socialgest/messenger/src/presenter/components/extras/__shared__/components/url-shortener/url-shortener.component.ts
6698var UrlShortenerComponent = class _UrlShortenerComponent {
6699  store = inject(MessengerStore);
6700  static \u0275fac = function UrlShortenerComponent_Factory(__ngFactoryType__) {
6701    return new (__ngFactoryType__ || _UrlShortenerComponent)();
6702  };
6703  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _UrlShortenerComponent, selectors: [["app-url-shortener"]], decls: 2, vars: 9, consts: [["icon", "link", 1, "cursor-pointer", 3, "click", "variant", "severity", "tooltip", "tooltipPosition", "positionTop", "styleClass"]], template: function UrlShortenerComponent_Template(rf, ctx) {
6704    if (rf & 1) {
6705      \u0275\u0275elementStart(0, "ui-button", 0);
6706      \u0275\u0275pipe(1, "translate");
6707      \u0275\u0275listener("click", function UrlShortenerComponent_Template_ui_button_click_0_listener() {
6708        return ctx.store.toggleShortener();
6709      });
6710      \u0275\u0275elementEnd();
6711    }
6712    if (rf & 2) {
6713      \u0275\u0275property("styleClass", \u0275\u0275interpolate(ctx.store.isShortenerActive() && "bg-secondary-50!"))("variant", ctx.store.isShortenerActive() ? "outlined" : void 0)("severity", ctx.store.isShortenerActive() ? "secondary" : "contrast")("tooltip", \u0275\u0275pipeBind1(1, 7, "MESSENGER.SHORTENER.TITLE"))("tooltipPosition", "top")("positionTop", -10);
6714    }
6715  }, dependencies: [TranslatePipe, ButtonComponent, TooltipDirective], encapsulation: 2 });
6716};
6717(() => {
6718  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(UrlShortenerComponent, [{
6719    type: Component,
6720    args: [{ selector: "app-url-shortener", imports: [TranslatePipe, ButtonComponent, TooltipDirective], template: `<ui-button
6721  (click)="store.toggleShortener()"
6722  icon="link"
6723  [variant]="store.isShortenerActive() ? 'outlined' : undefined"
6724  [severity]="store.isShortenerActive() ? 'secondary' : 'contrast'"
6725  [tooltip]="'MESSENGER.SHORTENER.TITLE' | translate"
6726  [tooltipPosition]="'top'"
6727  [positionTop]="-10"
6728  class="cursor-pointer"
6729  styleClass="{{ store.isShortenerActive() && 'bg-secondary-50!' }}"
6730/>
6731` }]
6732  }], null, null);
6733})();
6734(() => {
6735  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(UrlShortenerComponent, { className: "UrlShortenerComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/__shared__/components/url-shortener/url-shortener.component.ts", lineNumber: 11 });
6736})();
6737
6738// libs/socialgest/messenger/src/presenter/components/extras/facebook/facebook.component.ts
6739var FacebookComponent = class _FacebookComponent {
6740  store = inject(MessengerStore);
6741  static \u0275fac = function FacebookComponent_Factory(__ngFactoryType__) {
6742    return new (__ngFactoryType__ || _FacebookComponent)();
6743  };
6744  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _FacebookComponent, selectors: [["app-facebook"]], decls: 11, vars: 9, consts: [[1, "flex", "gap-12"], [3, "platform"], [1, "flex", "flex-col", "gap-2.5"], [1, "text-sm", "font-semibold"], [1, "flex", "gap-4"], [3, "userList", "userType"], [3, "userType"]], template: function FacebookComponent_Template(rf, ctx) {
6745    if (rf & 1) {
6746      \u0275\u0275elementStart(0, "section", 0);
6747      \u0275\u0275element(1, "app-publication-type", 1);
6748      \u0275\u0275elementStart(2, "div", 2)(3, "h3", 3);
6749      \u0275\u0275text(4);
6750      \u0275\u0275pipe(5, "translate");
6751      \u0275\u0275elementEnd();
6752      \u0275\u0275elementStart(6, "div", 4);
6753      \u0275\u0275element(7, "app-location", 5)(8, "app-first-comment", 5)(9, "app-mention", 6)(10, "app-url-shortener");
6754      \u0275\u0275elementEnd()()();
6755    }
6756    if (rf & 2) {
6757      \u0275\u0275advance();
6758      \u0275\u0275property("platform", "facebook");
6759      \u0275\u0275advance(3);
6760      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(5, 7, "MESSENGER.EXTRAS"));
6761      const userList_r1 = ctx.store.post().userList.facebook;
6762      \u0275\u0275advance(3);
6763      \u0275\u0275property("userList", userList_r1)("userType", userList_r1.first.type);
6764      \u0275\u0275advance();
6765      \u0275\u0275property("userList", userList_r1)("userType", userList_r1.first.type);
6766      \u0275\u0275advance();
6767      \u0275\u0275property("userType", userList_r1.first.type);
6768    }
6769  }, dependencies: [
6770    CommonModule,
6771    TranslatePipe,
6772    PublicationTypeComponent,
6773    LocationComponent,
6774    FirstCommentComponent,
6775    MentionComponent,
6776    UrlShortenerComponent
6777  ], encapsulation: 2 });
6778};
6779(() => {
6780  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(FacebookComponent, [{
6781    type: Component,
6782    args: [{ selector: "app-facebook", imports: [
6783      CommonModule,
6784      TranslatePipe,
6785      PublicationTypeComponent,
6786      LocationComponent,
6787      FirstCommentComponent,
6788      MentionComponent,
6789      UrlShortenerComponent
6790    ], template: `<section class="flex gap-12">
6791  <app-publication-type [platform]="'facebook'" />
6792
6793  <div class="flex flex-col gap-2.5">
6794    <h3 class="text-sm font-semibold">{{ 'MESSENGER.EXTRAS' | translate }}</h3>
6795
6796    <div class="flex gap-4">
6797      @let userList = store.post().userList.facebook;
6798      <app-location [userList]="userList" [userType]="userList.first.type" />
6799      <app-first-comment [userList]="userList" [userType]="userList.first.type" />
6800      <app-mention [userType]="userList.first.type" />
6801      <app-url-shortener />
6802    </div>
6803  </div>
6804</section>
6805` }]
6806  }], null, null);
6807})();
6808(() => {
6809  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(FacebookComponent, { className: "FacebookComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/facebook/facebook.component.ts", lineNumber: 26 });
6810})();
6811
6812// libs/socialgest/messenger/src/presenter/components/extras/instagram/components/collaborators/services/collaborator.service.ts
6813var CollaboratorService = class _CollaboratorService {
6814  http;
6815  constructor(http) {
6816    this.http = http;
6817  }
6818  search(term, userList) {
6819    const params = userList.has.items ? `users[0][userid]=${userList.first.id}&users[0][name]=${encodeURIComponent(term.replace("@", ""))}` : "";
6820    return this.http.get(`${environment.apiUrlV1}searchusers?${params}`).pipe(map((response) => {
6821      const user = response?.["3"]?.users;
6822      if (!!user && !!user.id) {
6823        return esm_exports.right([{ id: user.id, username: user.username, photo: user.profile_picture_url ?? "" }]);
6824      } else {
6825        return esm_exports.right([]);
6826      }
6827    }), catchError((err) => of(esm_exports.left(err))));
6828  }
6829  static \u0275fac = function CollaboratorService_Factory(__ngFactoryType__) {
6830    return new (__ngFactoryType__ || _CollaboratorService)(\u0275\u0275inject(HttpClient));
6831  };
6832  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _CollaboratorService, factory: _CollaboratorService.\u0275fac, providedIn: "root" });
6833};
6834(() => {
6835  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CollaboratorService, [{
6836    type: Injectable,
6837    args: [{ providedIn: "root" }]
6838  }], () => [{ type: HttpClient }], null);
6839})();
6840
6841// libs/socialgest/messenger/src/presenter/components/extras/instagram/components/collaborators/components/collaborator-searcher/collaborator-searcher.component.ts
6842function CollaboratorSearcherComponent_Conditional_6_ng_template_1_Template(rf, ctx) {
6843  if (rf & 1) {
6844    \u0275\u0275elementStart(0, "div", 10);
6845    \u0275\u0275element(1, "ui-avatar", 11);
6846    \u0275\u0275elementStart(2, "span", 12);
6847    \u0275\u0275text(3);
6848    \u0275\u0275elementEnd()();
6849  }
6850  if (rf & 2) {
6851    const segment_r4 = ctx.$implicit;
6852    \u0275\u0275advance();
6853    \u0275\u0275property("image", segment_r4.photo)("label", segment_r4.label);
6854    \u0275\u0275advance(2);
6855    \u0275\u0275textInterpolate(segment_r4.label);
6856  }
6857}
6858function CollaboratorSearcherComponent_Conditional_6_Template(rf, ctx) {
6859  if (rf & 1) {
6860    const _r2 = \u0275\u0275getCurrentView();
6861    \u0275\u0275elementStart(0, "ui-segment-list", 9);
6862    \u0275\u0275listener("valueChange", function CollaboratorSearcherComponent_Conditional_6_Template_ui_segment_list_valueChange_0_listener($event) {
6863      \u0275\u0275restoreView(_r2);
6864      const ctx_r2 = \u0275\u0275nextContext();
6865      return \u0275\u0275resetView(ctx_r2.insert($event));
6866    });
6867    \u0275\u0275template(1, CollaboratorSearcherComponent_Conditional_6_ng_template_1_Template, 4, 3, "ng-template", null, 1, \u0275\u0275templateRefExtractor);
6868    \u0275\u0275elementEnd();
6869  }
6870  if (rf & 2) {
6871    const ctx_r2 = \u0275\u0275nextContext();
6872    \u0275\u0275property("segments", ctx_r2.collaborators());
6873  }
6874}
6875function CollaboratorSearcherComponent_Conditional_7_Template(rf, ctx) {
6876  if (rf & 1) {
6877    \u0275\u0275elementStart(0, "section", 7);
6878    \u0275\u0275element(1, "ui-icon", 13);
6879    \u0275\u0275elementStart(2, "h3", 14);
6880    \u0275\u0275text(3);
6881    \u0275\u0275pipe(4, "translate");
6882    \u0275\u0275elementEnd()();
6883  }
6884  if (rf & 2) {
6885    \u0275\u0275advance(3);
6886    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 1, "MESSENGER.COLLABORATORS.INVITE_TITLE"));
6887  }
6888}
6889function CollaboratorSearcherComponent_Conditional_8_Template(rf, ctx) {
6890  if (rf & 1) {
6891    \u0275\u0275element(0, "ui-empty-list", 8);
6892  }
6893  if (rf & 2) {
6894    const ctx_r2 = \u0275\u0275nextContext();
6895    const searchInput_r5 = \u0275\u0275reference(3);
6896    \u0275\u0275property("hasItems", true)("noResultsLabel", "GLOBAL.EMPTY.NO_RESULTS_LIST_TITLE")("noResultsDescription", "GLOBAL.EMPTY.NO_RESULTS_LIST_DESC")("isScreenView", false)("isLoading", ctx_r2.isLoading() || ctx_r2.lastSearchedTerm() !== searchInput_r5.value())("width", "100%")("height", "100%");
6897  }
6898}
6899var CollaboratorSearcherComponent = class _CollaboratorSearcherComponent {
6900  userList = input.required();
6901  valueChange = output();
6902  store = inject(MessengerStore);
6903  collaboratorService = inject(CollaboratorService);
6904  isLoading = signal(false);
6905  collaborators = signal([]);
6906  lastSearchedTerm = signal("");
6907  search(term) {
6908    if (!term.trim()) {
6909      this.collaborators.set([]);
6910      this.lastSearchedTerm.set("");
6911      return;
6912    }
6913    this.isLoading.set(true);
6914    this.collaboratorService.search(term, this.userList()).subscribe({
6915      next: (result) => {
6916        result.mapRight((_) => {
6917          this.collaborators.set(_.map(({ id, username, photo }) => ({ label: username, value: id, photo })));
6918        });
6919        result.mapLeft(() => this.collaborators.set([]));
6920        this.lastSearchedTerm.set(term);
6921        this.isLoading.set(false);
6922      },
6923      error: () => {
6924        this.collaborators.set([]);
6925        this.isLoading.set(false);
6926      },
6927      complete: () => {
6928        this.lastSearchedTerm.set(term);
6929        this.isLoading.set(false);
6930      }
6931    });
6932  }
6933  insert(id) {
6934    const { value, label, photo } = this.collaborators().find(({ value: value2 }) => value2 === id);
6935    this.store.post().options.instagram.collaboratorList.insert({ id: value, username: label, photo });
6936    this.collaborators.set([]);
6937    this.valueChange.emit();
6938  }
6939  static \u0275fac = function CollaboratorSearcherComponent_Factory(__ngFactoryType__) {
6940    return new (__ngFactoryType__ || _CollaboratorSearcherComponent)();
6941  };
6942  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _CollaboratorSearcherComponent, selectors: [["app-collaborator-searcher"]], inputs: { userList: [1, "userList"] }, outputs: { valueChange: "valueChange" }, decls: 9, vars: 4, consts: [["searchInput", ""], ["item", ""], [1, "size-full", "grid", "grid-rows-[auto_1fr]"], [1, "flex", "flex-col", "gap-3", "mb-5"], ["size", "small", 3, "valueChange", "placeholder"], [1, "h-full", "p-1.5", "flex", "flex-col", "gap-2"], ["itemStyleClass", "h-10! rounded-md! border-grey-100 px-4! py-1.5! mb-1", 1, "segment-thin", 2, "--p-card-body-
6942padding", "0", 3, "segments"], [1, "h-full", "flex", "flex-col", "justify-center", "items-center", "gap-2", "-mt-4"], ["emptyTitleStyleClass", "text-md! px-0!", "emptyDescriptionStyleClass", "text-sm! px-0!", "emptyStyleClass", "gap-2! pt-6!", "iconStyleClass", "size-16!", 3, "hasItems", "noResultsLabel", "noResultsDescription", "isScreenView", "isLoading", "width", "height"], ["itemStyleClass", "h-10! rounded-md! border-grey-100 px-4! py-1.5! mb-1", 1, "segment-thin", 2, "--p-card-body-padding", "0", 3, "valueChange", "segments"], [1, "flex", "items-center", "gap-3"], ["styleClass", "size-6!", 3, "image", "label"], [1, "block", "flex-1", "font-display", "text-sm", "font-semibold", "truncate"], ["name", "users", "strokeWidth", "1", "styleClass", "text-grey-300 size-16"], [1, "font-medium", "text-grey-500"]], template: function CollaboratorSearcherComponent_Template(rf, ctx) {
6943    if (rf & 1) {
6944      const _r1 = \u0275\u0275getCurrentView();
6945      \u0275\u0275elementStart(0, "article", 2)(1, "header", 3)(2, "ui-input-search", 4, 0);
6946      \u0275\u0275pipe(4, "translate");
6947      \u0275\u0275listener("valueChange", function CollaboratorSearcherComponent_Template_ui_input_search_valueChange_2_listener($event) {
6948        \u0275\u0275restoreView(_r1);
6949        return \u0275\u0275resetView(ctx.search($event));
6950      });
6951      \u0275\u0275elementEnd()();
6952      \u0275\u0275elementStart(5, "section", 5);
6953      \u0275\u0275conditionalCreate(6, CollaboratorSearcherComponent_Conditional_6_Template, 3, 1, "ui-segment-list", 6)(7, CollaboratorSearcherComponent_Conditional_7_Template, 5, 3, "section", 7)(8, CollaboratorSearcherComponent_Conditional_8_Template, 1, 7, "ui-empty-list", 8);
6954      \u0275\u0275elementEnd()();
6955    }
6956    if (rf & 2) {
6957      const searchInput_r5 = \u0275\u0275reference(3);
6958      \u0275\u0275advance(2);
6959      \u0275\u0275property("placeholder", \u0275\u0275pipeBind1(4, 2, "MESSENGER.COLLABORATORS.SEARCH"));
6960      \u0275\u0275advance(4);
6961      \u0275\u0275conditional(!ctx.isLoading() && ctx.collaborators().length > 0 ? 6 : !ctx.isLoading() && (searchInput_r5.value() === "" || ctx.lastSearchedTerm() === "") ? 7 : 8);
6962    }
6963  }, dependencies: [
6964    CommonModule,
6965    TranslatePipe,
6966    AvatarComponent,
6967    IconComponent,
6968    InputSearchComponent,
6969    SegmentListComponent,
6970    EmptyListComponent
6971  ], encapsulation: 2 });
6972};
6973(() => {
6974  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CollaboratorSearcherComponent, [{
6975    type: Component,
6976    args: [{ selector: "app-collaborator-searcher", imports: [
6977      CommonModule,
6978      TranslatePipe,
6979      AvatarComponent,
6980      IconComponent,
6981      ButtonComponent,
6982      InputSearchComponent,
6983      SegmentListComponent,
6984      EmptyListComponent
6985    ], template: `<article class="size-full grid grid-rows-[auto_1fr]">
6986  <header class="flex flex-col gap-3 mb-5">
6987    <ui-input-search
6988      #searchInput
6989      (valueChange)="search($event)"
6990      [placeholder]="'MESSENGER.COLLABORATORS.SEARCH' | translate"
6991      size="small"
6992    />
6993  </header>
6994
6995  <section class="h-full p-1.5 flex flex-col gap-2">
6996    @if (!isLoading() && collaborators().length > 0) {
6997
6998    <ui-segment-list
6999      (valueChange)="insert($event)"
7000      [segments]="collaborators()"
7001      itemStyleClass="h-10! rounded-md! border-grey-100 px-4! py-1.5! mb-1"
7002      class="segment-thin"
7003      style="--p-card-body-padding: 0"
7004    >
7005      <ng-template #item let-segment>
7006        <div class="flex items-center gap-3">
7007          <ui-avatar [image]="segment.photo" [label]="segment.label" styleClass="size-6!" />
7008          <span class="block flex-1 font-display text-sm font-semibold truncate">{{ segment.label }}</span>
7009        </div>
7010      </ng-template>
7011    </ui-segment-list>
7012
7013    }@else if (!isLoading() && (searchInput.value() === '' || lastSearchedTerm() === '')) {
7014
7015    <section class="h-full flex flex-col justify-center items-center gap-2 -mt-4">
7016      <ui-icon name="users" strokeWidth="1" styleClass="text-grey-300 size-16" />
7017      <h3 class="font-medium text-grey-500">{{ 'MESSENGER.COLLABORATORS.INVITE_TITLE' | translate }}</h3>
7018    </section>
7019
7020    } @else {
7021
7022    <ui-empty-list
7023      [hasItems]="true"
7024      [noResultsLabel]="'GLOBAL.EMPTY.NO_RESULTS_LIST_TITLE'"
7025      [noResultsDescription]="'GLOBAL.EMPTY.NO_RESULTS_LIST_DESC'"
7026      [isScreenView]="false"
7027      [isLoading]="isLoading() || lastSearchedTerm() !== searchInput.value()"
7028      [width]="'100%'"
7029      [height]="'100%'"
7030      emptyTitleStyleClass="text-md! px-0!"
7031      emptyDescriptionStyleClass="text-sm! px-0!"
7032      emptyStyleClass="gap-2! pt-6!"
7033      iconStyleClass="size-16!"
7034    />
7035
7036    }
7037  </section>
7038</article>
7039` }]
7040  }], null, null);
7041})();
7042(() => {
7043  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(CollaboratorSearcherComponent, { className: "CollaboratorSearcherComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/instagram/components/collaborators/components/collaborator-searcher/collaborator-searcher.component.ts", lineNumber: 24 });
7044})();
7045
7046// libs/socialgest/messenger/src/presenter/components/extras/instagram/components/collaborators/components/collaborators-added/collaborators-added.component.ts
7047var _forTrack02 = ($index, $item) => $item.id;
7048function CollaboratorsAddedComponent_For_6_Template(rf, ctx) {
7049  if (rf & 1) {
7050    const _r1 = \u0275\u0275getCurrentView();
7051    \u0275\u0275elementStart(0, "li", 2)(1, "div", 4);
7052    \u0275\u0275element(2, "ui-avatar", 5);
7053    \u0275\u0275elementStart(3, "span", 6);
7054    \u0275\u0275text(4);
7055    \u0275\u0275elementEnd()();
7056    \u0275\u0275elementStart(5, "ui-icon", 7);
7057    \u0275\u0275listener("click", function CollaboratorsAddedComponent_For_6_Template_ui_icon_click_5_listener() {
7058      const collaborator_r2 = \u0275\u0275restoreView(_r1).$implicit;
7059      const ctx_r2 = \u0275\u0275nextContext();
7060      return \u0275\u0275resetView(ctx_r2.remove(collaborator_r2.id));
7061    });
7062    \u0275\u0275elementEnd()();
7063  }
7064  if (rf & 2) {
7065    const collaborator_r2 = ctx.$implicit;
7066    \u0275\u0275advance(2);
7067    \u0275\u0275property("image", collaborator_r2.photo)("label", collaborator_r2.username);
7068    \u0275\u0275advance(2);
7069    \u0275\u0275textInterpolate(collaborator_r2.username);
7070  }
7071}
7072function CollaboratorsAddedComponent_Conditional_7_Template(rf, ctx) {
7073  if (rf & 1) {
7074    const _r4 = \u0275\u0275getCurrentView();
7075    \u0275\u0275elementStart(0, "ui-button", 8);
7076    \u0275\u0275pipe(1, "translate");
7077    \u0275\u0275listener("click", function CollaboratorsAddedComponent_Conditional_7_Template_ui_button_click_0_listener() {
7078      \u0275\u0275restoreView(_r4);
7079      const ctx_r2 = \u0275\u0275nextContext();
7080      return \u0275\u0275resetView(ctx_r2.valueChange.emit());
7081    });
7082    \u0275\u0275elementEnd();
7083  }
7084  if (rf & 2) {
7085    \u0275\u0275property("label", \u0275\u0275pipeBind1(1, 1, "MESSENGER.COLLABORATORS.ADD_OTHER"));
7086  }
7087}
7088var CollaboratorsAddedComponent = class _CollaboratorsAddedComponent {
7089  store = inject(MessengerStore);
7090  valueChange = output();
7091  remove(id) {
7092    this.store.post().options.instagram.collaboratorList.remove(id);
7093    if (this.store.post().options.instagram.collaboratorList.isEmpty) {
7094      this.valueChange.emit();
7095    }
7096  }
7097  static \u0275fac = function CollaboratorsAddedComponent_Factory(__ngFactoryType__) {
7098    return new (__ngFactoryType__ || _CollaboratorsAddedComponent)();
7099  };
7100  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _CollaboratorsAddedComponent, selectors: [["app-collaborators-added"]], outputs: { valueChange: "valueChange" }, decls: 8, vars: 4, consts: [[1, "size-full", "grid", "grid-rows-[auto_1fr_auto]", "gap-2"], [1, "font-sans", "font-medium", "text-sm", "text-grey-500"], [1, "flex", "items-center", "gap-4", "mb-3"], ["icon", "circlePlus", "severity", "contrast", 3, "label"], [1, "w-full", "flex", "items-center", "gap-3", "rounded-lg", "border", "border-grey-100", "px-3", "py-2", "bg-white"], ["size", "normal", "styleClass", "size-6!", 3, "image", "label"], [1, "block", "flex-1", "font-display", "text-sm", "font-semibold", "truncate"], ["name", "trash", "styleClass", "size-5! cursor-pointer text-grey-300", 3, "click"], ["icon", "circlePlus", "severity", "contrast", 3, "click", "label"]], template: function CollaboratorsAddedComponent_Template(rf, ctx) {
7101    if (rf & 1) {
7102      \u0275\u0275elementStart(0, "article", 0)(1, "h3", 1);
7103      \u0275\u0275text(2);
7104      \u0275\u0275pipe(3, "translate");
7105      \u0275\u0275elementEnd();
7106      \u0275\u0275elementStart(4, "ul");
7107      \u0275\u0275repeaterCreate(5, CollaboratorsAddedComponent_For_6_Template, 6, 3, "li", 2, _forTrack02);
7108      \u0275\u0275elementEnd();
7109      \u0275\u0275conditionalCreate(7, CollaboratorsAddedComponent_Conditional_7_Template, 2, 3, "ui-button", 3);
7110      \u0275\u0275elementEnd();
7111    }
7112    if (rf & 2) {
7113      \u0275\u0275advance(2);
7114      \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(3, 2, "MESSENGER.COLLABORATORS.ADDED_TITLE"), " ");
7115      \u0275\u0275advance(3);
7116      \u0275\u0275repeater(ctx.store.post().options.instagram.collaboratorList.items);
7117      \u0275\u0275advance(2);
7118      \u0275\u0275conditional(ctx.store.post().options.instagram.collaboratorList.canInsert ? 7 : -1);
7119    }
7120  }, dependencies: [CommonModule, TranslatePipe, AvatarComponent, IconComponent, ButtonComponent], encapsulation: 2 });
7121};
7122(() => {
7123  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CollaboratorsAddedComponent, [{
7124    type: Component,
7125    args: [{ selector: "app-collaborators-added", imports: [CommonModule, TranslatePipe, AvatarComponent, IconComponent, ButtonComponent], template: `<article class="size-full grid grid-rows-[auto_1fr_auto] gap-2">
7126  <h3 class="font-sans font-medium text-sm text-grey-500">
7127    {{ 'MESSENGER.COLLABORATORS.ADDED_TITLE' | translate }}
7128  </h3>
7129
7130  <ul>
7131    @for (collaborator of store.post().options.instagram.collaboratorList.items; track collaborator.id) {
7132    <li class="flex items-center gap-4 mb-3">
7133      <div class="w-full flex items-center gap-3 rounded-lg border border-grey-100 px-3 py-2 bg-white">
7134        <ui-avatar [image]="collaborator.photo" [label]="collaborator.username" size="normal" styleClass="size-6!" />
7135        <span class="block flex-1 font-display text-sm font-semibold truncate">{{ collaborator.username }}</span>
7136      </div>
7137
7138      <ui-icon (click)="remove(collaborator.id)" name="trash" styleClass="size-5! cursor-pointer text-grey-300" />
7139    </li>
7140    }
7141  </ul>
7142
7143  @if(store.post().options.instagram.collaboratorList.canInsert ){
7144  <ui-button
7145    (click)="valueChange.emit()"
7146    [label]="'MESSENGER.COLLABORATORS.ADD_OTHER' | translate"
7147    icon="circlePlus"
7148    severity="contrast"
7149  />
7150  }
7151</article>
7152` }]
7153  }], null, null);
7154})();
7155(() => {
7156  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(CollaboratorsAddedComponent, { className: "CollaboratorsAddedComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/instagram/components/collaborators/components/collaborators-added/collaborators-added.component.ts", lineNumber: 12 });
7157})();
7158
7159// libs/socialgest/messenger/src/presenter/components/extras/instagram/components/collaborators/collaborators.component.ts
7160function CollaboratorsComponent_Conditional_5_Template(rf, ctx) {
7161  if (rf & 1) {
7162    const _r3 = \u0275\u0275getCurrentView();
7163    \u0275\u0275elementStart(0, "app-collaborators-added", 5);
7164    \u0275\u0275listener("valueChange", function CollaboratorsComponent_Conditional_5_Template_app_collaborators_added_valueChange_0_listener() {
7165      \u0275\u0275restoreView(_r3);
7166      const ctx_r3 = \u0275\u0275nextContext();
7167      return \u0275\u0275resetView(ctx_r3.mode.set("searcher"));
7168    });
7169    \u0275\u0275elementEnd();
7170  }
7171}
7172function CollaboratorsComponent_Conditional_6_Template(rf, ctx) {
7173  if (rf & 1) {
7174    const _r5 = \u0275\u0275getCurrentView();
7175    \u0275\u0275elementStart(0, "app-collaborator-searcher", 6);
7176    \u0275\u0275listener("valueChange", function CollaboratorsComponent_Conditional_6_Template_app_collaborator_searcher_valueChange_0_listener() {
7177      \u0275\u0275restoreView(_r5);
7178      const ctx_r3 = \u0275\u0275nextContext();
7179      return \u0275\u0275resetView(ctx_r3.mode.set("added"));
7180    });
7181    \u0275\u0275elementEnd();
7182  }
7183  if (rf & 2) {
7184    const ctx_r3 = \u0275\u0275nextContext();
7185    \u0275\u0275property("userList", ctx_r3.userList());
7186  }
7187}
7188var CollaboratorsComponent = class _CollaboratorsComponent {
7189  userList = input.required();
7190  store = inject(MessengerStore);
7191  mode = signal("searcher");
7192  ngOnInit() {
7193    if (this.store.post().options.instagram.collaboratorList.isPresent) {
7194      this.mode.set("added");
7195    }
7196  }
7197  static \u0275fac = function CollaboratorsComponent_Factory(__ngFactoryType__) {
7198    return new (__ngFactoryType__ || _CollaboratorsComponent)();
7199  };
7200  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _CollaboratorsComponent, selectors: [["app-collaborators"]], inputs: { userList: [1, "userList"] }, decls: 7, vars: 11, consts: [["popover", ""], ["icon", "users", 1, "cursor-pointer", 3, "click", "variant", "severity", "tooltip", "tooltipPosition", "positionTop", "styleClass"], ["styleClass", "w-[19rem] -mt-5! no-gutter"], [1, "h-[21.5rem]", "p-5"], [3, "userList"], [3, "valueChange"], [3, "valueChange", "userList"]], template: function CollaboratorsComponent_Template(rf, ctx) {
7201    if (rf & 1) {
7202      const _r1 = \u0275\u0275getCurrentView();
7203      \u0275\u0275elementStart(0, "ui-button", 1);
7204      \u0275\u0275pipe(1, "translate");
7205      \u0275\u0275listener("click", function CollaboratorsComponent_Template_ui_button_click_0_listener($event) {
7206        \u0275\u0275restoreView(_r1);
7207        const popover_r2 = \u0275\u0275reference(3);
7208        return \u0275\u0275resetView(popover_r2.toggle($event));
7209      });
7210      \u0275\u0275elementEnd();
7211      \u0275\u0275elementStart(2, "ui-popover", 2, 0)(4, "article", 3);
7212      \u0275\u0275conditionalCreate(5, CollaboratorsComponent_Conditional_5_Template, 1, 0, "app-collaborators-added")(6, CollaboratorsComponent_Conditional_6_Template, 1, 1, "app-collaborator-searcher", 4);
7213      \u0275\u0275elementEnd()();
7214    }
7215    if (rf & 2) {
7216      const popover_r2 = \u0275\u0275reference(3);
7217      const hasCollaborators_r6 = ctx.store.post().options.instagram.collaboratorList.isPresent;
7218      \u0275\u0275property("styleClass", \u0275\u0275interpolate2("\n  ", popover_r2.isOpen() && "bg-grey-50!", "\n  ", hasCollaborators_r6 && " bg-secondary-50!"))("variant", hasCollaborators_r6 ? "outlined" : void 0)("severity", hasCollaborators_r6 ? "secondary" : "contrast")("tooltip", \u0275\u0275pipeBind1(1, 9, "MESSENGER.COLLABORATORS.TITLE"))("tooltipPosition", "top")("positionTop", -10);
7219      \u0275\u0275advance(5);
7220      \u0275\u0275conditional(ctx.mode() === "added" ? 5 : 6);
7221    }
7222  }, dependencies: [
7223    CommonModule,
7224    TranslatePipe,
7225    PopoverComponent,
7226    ButtonComponent,
7227    TooltipDirective,
7228    CollaboratorSearcherComponent,
7229    CollaboratorsAddedComponent
7230  ], encapsulation: 2 });
7231};
7232(() => {
7233  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(CollaboratorsComponent, [{
7234    type: Component,
7235    args: [{ selector: "app-collaborators", imports: [
7236      CommonModule,
7237      TranslatePipe,
7238      PopoverComponent,
7239      ButtonComponent,
7240      TooltipDirective,
7241      CollaboratorSearcherComponent,
7242      CollaboratorsAddedComponent
7243    ], template: `@let hasCollaborators = store.post().options.instagram.collaboratorList.isPresent;
7244
7245<ui-button
7246  (click)="popover.toggle($event)"
7247  icon="users"
7248  [variant]="hasCollaborators ? 'outlined' : undefined"
7249  [severity]="hasCollaborators ? 'secondary' : 'contrast'"
7250  [tooltip]="'MESSENGER.COLLABORATORS.TITLE' | translate"
7251  [tooltipPosition]="'top'"
7252  [positionTop]="-10"
7253  class="cursor-pointer"
7254  styleClass="
7255  {{ popover.isOpen() && 'bg-grey-50!' }}
7256  {{ hasCollaborators && ' bg-secondary-50!' }}"
7257/>
7258
7259<ui-popover #popover styleClass="w-[19rem] -mt-5! no-gutter">
7260  <article class="h-[21.5rem] p-5">
7261    @if(mode() === 'added'){
7262    <app-collaborators-added (valueChange)="mode.set('searcher')" />
7263    } @else {
7264    <app-collaborator-searcher (valueChange)="mode.set('added')" [userList]="userList()" />
7265    }
7266  </article>
7267</ui-popover>
7268` }]
7269  }], null, null);
7270})();
7271(() => {
7272  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(CollaboratorsComponent, { className: "CollaboratorsComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/instagram/components/collaborators/collaborators.component.ts", lineNumber: 21 });
7273})();
7274
7275// libs/socialgest/messenger/src/presenter/components/extras/instagram/components/tags/services/tag.service.ts
7276var TagService = class _TagService {
7277  http;
7278  constructor(http) {
7279    this.http = http;
7280  }
7281  search(term, userList) {
7282    const params = userList.has.items ? `users[0][userid]=${userList.first.id}&users[0][name]=${encodeURIComponent(term.replace("@", ""))}` : "";
7283    return this.http.get(`${environment.apiUrlV1}searchusers?${params}`).pipe(map((response) => {
7284      const user = response?.["3"]?.users;
7285      if (!!user && !!user.id) {
7286        return esm_exports.right([{ id: user.id, username: user.username, photo: user.profile_picture_url ?? "" }]);
7287      } else {
7288        return esm_exports.right([]);
7289      }
7290    }), catchError((err) => of(esm_exports.left(err))));
7291  }
7292  static \u0275fac = function TagService_Factory(__ngFactoryType__) {
7293    return new (__ngFactoryType__ || _TagService)(\u0275\u0275inject(HttpClient));
7294  };
7295  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _TagService, factory: _TagService.\u0275fac, providedIn: "root" });
7296};
7297(() => {
7298  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TagService, [{
7299    type: Injectable,
7300    args: [{ providedIn: "root" }]
7301  }], () => [{ type: HttpClient }], null);
7302})();
7303
7304// libs/socialgest/messenger/src/presenter/components/extras/instagram/components/tags/components/tag-searcher/tag-searcher.component.ts
7305function TagSearcherComponent_Conditional_6_ng_template_1_Template(rf, ctx) {
7306  if (rf & 1) {
7307    \u0275\u0275elementStart(0, "div", 10);
7308    \u0275\u0275element(1, "ui-avatar", 11);
7309    \u0275\u0275elementStart(2, "span", 12);
7310    \u0275\u0275text(3);
7311    \u0275\u0275elementEnd()();
7312  }
7313  if (rf & 2) {
7314    const segment_r4 = ctx.$implicit;
7315    \u0275\u0275advance();
7316    \u0275\u0275property("image", segment_r4.photo)("label", segment_r4.label);
7317    \u0275\u0275advance(2);
7318    \u0275\u0275textInterpolate(segment_r4.label);
7319  }
7320}
7321function TagSearcherComponent_Conditional_6_Template(rf, ctx) {
7322  if (rf & 1) {
7323    const _r2 = \u0275\u0275getCurrentView();
7324    \u0275\u0275elementStart(0, "ui-segment-list", 9);
7325    \u0275\u0275listener("valueChange", function TagSearcherComponent_Conditional_6_Template_ui_segment_list_valueChange_0_listener($event) {
7326      \u0275\u0275restoreView(_r2);
7327      const ctx_r2 = \u0275\u0275nextContext();
7328      return \u0275\u0275resetView(ctx_r2.insert($event));
7329    });
7330    \u0275\u0275template(1, TagSearcherComponent_Conditional_6_ng_template_1_Template, 4, 3, "ng-template", null, 1, \u0275\u0275templateRefExtractor);
7331    \u0275\u0275elementEnd();
7332  }
7333  if (rf & 2) {
7334    const ctx_r2 = \u0275\u0275nextContext();
7335    \u0275\u0275property("segments", ctx_r2.tags());
7336  }
7337}
7338function TagSearcherComponent_Conditional_7_Template(rf, ctx) {
7339  if (rf & 1) {
7340    \u0275\u0275elementStart(0, "section", 7);
7341    \u0275\u0275element(1, "ui-icon", 13);
7342    \u0275\u0275elementStart(2, "h3", 14);
7343    \u0275\u0275text(3);
7344    \u0275\u0275pipe(4, "translate");
7345    \u0275\u0275elementEnd()();
7346  }
7347  if (rf & 2) {
7348    \u0275\u0275advance(3);
7349    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 1, "MESSENGER.TAGS.SEARCH_HINT"));
7350  }
7351}
7352function TagSearcherComponent_Conditional_8_Template(rf, ctx) {
7353  if (rf & 1) {
7354    \u0275\u0275element(0, "ui-empty-list", 8);
7355  }
7356  if (rf & 2) {
7357    const ctx_r2 = \u0275\u0275nextContext();
7358    const searchInput_r5 = \u0275\u0275reference(3);
7359    \u0275\u0275property("hasItems", true)("noResultsLabel", "GLOBAL.EMPTY.NO_RESULTS_LIST_TITLE")("noResultsDescription", "GLOBAL.EMPTY.NO_RESULTS_LIST_DESC")("isScreenView", false)("isLoading", ctx_r2.isLoading() || ctx_r2.lastSearchedTerm() !== searchInput_r5.value())("width", "100%")("height", "100%");
7360  }
7361}
7362var TagSearcherComponent = class _TagSearcherComponent {
7363  userList = input.required();
7364  valueChange = output();
7365  analytics = inject(AnalyticsService);
7366  store = inject(MessengerStore);
7367  tagService = inject(TagService);
7368  isLoading = signal(false);
7369  tags = signal([]);
7370  lastSearchedTerm = signal("");
7371  search(term) {
7372    if (!term.trim()) {
7373      this.tags.set([]);
7374      this.lastSearchedTerm.set("");
7375      return;
7376    }
7377    this.isLoading.set(true);
7378    this.tagService.search(term, this.userList()).subscribe({
7379      next: (result) => {
7380        result.mapRight((_) => {
7381          this.tags.set(_.map(({ username, photo }) => ({ label: username, value: username, photo })));
7382        });
7383        result.mapLeft(() => this.tags.set([]));
7384        this.lastSearchedTerm.set(term);
7385        this.isLoading.set(false);
7386      },
7387      error: () => {
7388        this.tags.set([]);
7389        this.isLoading.set(false);
7390      },
7391      complete: () => {
7392        this.lastSearchedTerm.set(term);
7393        this.isLoading.set(false);
7394      }
7395    });
7396  }
7397  insert(username) {
7398    const { label, photo } = this.tags().find(({ value }) => value === username);
7399    this.analytics.capture("messenger_tag_created");
7400    this.store.post().options.instagram.tagList.insert({ username: label, photo });
7401    this.tags.set([]);
7402    this.valueChange.emit();
7403  }
7404  static \u0275fac = function TagSearcherComponent_Factory(__ngFactoryType__) {
7405    return new (__ngFactoryType__ || _TagSearcherComponent)();
7406  };
7407  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _TagSearcherComponent, selectors: [["app-tag-searcher"]], inputs: { userList: [1, "userList"] }, outputs: { valueChange: "valueChange" }, decls: 9, vars: 4, consts: [["searchInput", ""], ["item", ""], [1, "size-full", "grid", "grid-rows-[auto_1fr]"], [1, "flex", "flex-col", "gap-3", "mb-5"], ["size", "small", 3, "valueChange", "placeholder"], [1, "h-full", "p-1.5", "flex", "flex-col", "gap-2"], ["itemStyleClass", "h-10! rounded-md! border-grey-100 px-4! py-1.5! mb-1", 1, "segment-thin", 2, "--p-card-body-
7407padding", "0", 3, "segments"], [1, "h-full", "flex", "flex-col", "justify-center", "items-center", "gap-2", "-mt-4"], ["emptyTitleStyleClass", "text-md! px-0!", "emptyDescriptionStyleClass", "text-sm! px-0!", "emptyStyleClass", "gap-2! pt-6!", "iconStyleClass", "size-16!", 3, "hasItems", "noResultsLabel", "noResultsDescription", "isScreenView", "isLoading", "width", "height"], ["itemStyleClass", "h-10! rounded-md! border-grey-100 px-4! py-1.5! mb-1", 1, "segment-thin", 2, "--p-card-body-padding", "0", 3, "valueChange", "segments"], [1, "flex", "items-center", "gap-3"], ["styleClass", "size-6!", 3, "image", "label"], [1, "block", "flex-1", "font-display", "text-sm", "font-semibold", "truncate"], ["name", "users", "strokeWidth", "1", "styleClass", "text-grey-300 size-16"], [1, "font-medium", "text-grey-500", "text-center"]], template: function TagSearcherComponent_Template(rf, ctx) {
7408    if (rf & 1) {
7409      const _r1 = \u0275\u0275getCurrentView();
7410      \u0275\u0275elementStart(0, "article", 2)(1, "header", 3)(2, "ui-input-search", 4, 0);
7411      \u0275\u0275pipe(4, "translate");
7412      \u0275\u0275listener("valueChange", function TagSearcherComponent_Template_ui_input_search_valueChange_2_listener($event) {
7413        \u0275\u0275restoreView(_r1);
7414        return \u0275\u0275resetView(ctx.search($event));
7415      });
7416      \u0275\u0275elementEnd()();
7417      \u0275\u0275elementStart(5, "section", 5);
7418      \u0275\u0275conditionalCreate(6, TagSearcherComponent_Conditional_6_Template, 3, 1, "ui-segment-list", 6)(7, TagSearcherComponent_Conditional_7_Template, 5, 3, "section", 7)(8, TagSearcherComponent_Conditional_8_Template, 1, 7, "ui-empty-list", 8);
7419      \u0275\u0275elementEnd()();
7420    }
7421    if (rf & 2) {
7422      const searchInput_r5 = \u0275\u0275reference(3);
7423      \u0275\u0275advance(2);
7424      \u0275\u0275property("placeholder", \u0275\u0275pipeBind1(4, 2, "MESSENGER.TAGS.SEARCH"));
7425      \u0275\u0275advance(4);
7426      \u0275\u0275conditional(!ctx.isLoading() && ctx.tags().length > 0 ? 6 : !ctx.isLoading() && (searchInput_r5.value() === "" || ctx.lastSearchedTerm() === "") ? 7 : 8);
7427    }
7428  }, dependencies: [
7429    CommonModule,
7430    TranslatePipe,
7431    AvatarComponent,
7432    IconComponent,
7433    InputSearchComponent,
7434    SegmentListComponent,
7435    EmptyListComponent
7436  ], encapsulation: 2 });
7437};
7438(() => {
7439  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TagSearcherComponent, [{
7440    type: Component,
7441    args: [{ selector: "app-tag-searcher", imports: [
7442      CommonModule,
7443      TranslatePipe,
7444      AvatarComponent,
7445      IconComponent,
7446      ButtonComponent,
7447      InputSearchComponent,
7448      SegmentListComponent,
7449      EmptyListComponent
7450    ], template: `<article class="size-full grid grid-rows-[auto_1fr]">
7451  <header class="flex flex-col gap-3 mb-5">
7452    <ui-input-search
7453      #searchInput
7454      (valueChange)="search($event)"
7455      [placeholder]="'MESSENGER.TAGS.SEARCH' | translate"
7456      size="small"
7457    />
7458  </header>
7459
7460  <section class="h-full p-1.5 flex flex-col gap-2">
7461    @if (!isLoading() && tags().length > 0) {
7462
7463    <ui-segment-list
7464      (valueChange)="insert($event)"
7465      [segments]="tags()"
7466      itemStyleClass="h-10! rounded-md! border-grey-100 px-4! py-1.5! mb-1"
7467      class="segment-thin"
7468      style="--p-card-body-padding: 0"
7469    >
7470      <ng-template #item let-segment>
7471        <div class="flex items-center gap-3">
7472          <ui-avatar [image]="segment.photo" [label]="segment.label" styleClass="size-6!" />
7473          <span class="block flex-1 font-display text-sm font-semibold truncate">{{ segment.label }}</span>
7474        </div>
7475      </ng-template>
7476    </ui-segment-list>
7477
7478    }@else if (!isLoading() && (searchInput.value() === '' || lastSearchedTerm() === '')) {
7479
7480    <section class="h-full flex flex-col justify-center items-center gap-2 -mt-4">
7481      <ui-icon name="users" strokeWidth="1" styleClass="text-grey-300 size-16" />
7482      <h3 class="font-medium text-grey-500 text-center">{{ 'MESSENGER.TAGS.SEARCH_HINT' | translate }}</h3>
7483    </section>
7484
7485    } @else {
7486
7487    <ui-empty-list
7488      [hasItems]="true"
7489      [noResultsLabel]="'GLOBAL.EMPTY.NO_RESULTS_LIST_TITLE'"
7490      [noResultsDescription]="'GLOBAL.EMPTY.NO_RESULTS_LIST_DESC'"
7491      [isScreenView]="false"
7492      [isLoading]="isLoading() || lastSearchedTerm() !== searchInput.value()"
7493      [width]="'100%'"
7494      [height]="'100%'"
7495      emptyTitleStyleClass="text-md! px-0!"
7496      emptyDescriptionStyleClass="text-sm! px-0!"
7497      emptyStyleClass="gap-2! pt-6!"
7498      iconStyleClass="size-16!"
7499    />
7500
7501    }
7502  </section>
7503</article>
7504` }]
7505  }], null, null);
7506})();
7507(() => {
7508  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(TagSearcherComponent, { className: "TagSearcherComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/instagram/components/tags/components/tag-searcher/tag-searcher.component.ts", lineNumber: 25 });
7509})();
7510
7511// libs/socialgest/messenger/src/presenter/components/extras/instagram/components/tags/components/tag-added/tag-added.component.ts
7512var _forTrack03 = ($index, $item) => $item.username;
7513function TagAddedComponent_For_6_Template(rf, ctx) {
7514  if (rf & 1) {
7515    const _r1 = \u0275\u0275getCurrentView();
7516    \u0275\u0275elementStart(0, "li", 3)(1, "div", 5);
7517    \u0275\u0275element(2, "ui-avatar", 6);
7518    \u0275\u0275elementStart(3, "span", 7);
7519    \u0275\u0275text(4);
7520    \u0275\u0275elementEnd()();
7521    \u0275\u0275elementStart(5, "ui-icon", 8);
7522    \u0275\u0275listener("click", function TagAddedComponent_For_6_Template_ui_icon_click_5_listener() {
7523      const tag_r2 = \u0275\u0275restoreView(_r1).$implicit;
7524      const ctx_r2 = \u0275\u0275nextContext();
7525      return \u0275\u0275resetView(ctx_r2.remove(tag_r2.username));
7526    });
7527    \u0275\u0275elementEnd()();
7528  }
7529  if (rf & 2) {
7530    const tag_r2 = ctx.$implicit;
7531    \u0275\u0275advance(2);
7532    \u0275\u0275property("image", tag_r2.photo)("label", tag_r2.username);
7533    \u0275\u0275advance(2);
7534    \u0275\u0275textInterpolate(tag_r2.username);
7535  }
7536}
7537function TagAddedComponent_Conditional_7_Template(rf, ctx) {
7538  if (rf & 1) {
7539    const _r4 = \u0275\u0275getCurrentView();
7540    \u0275\u0275elementStart(0, "ui-button", 9);
7541    \u0275\u0275pipe(1, "translate");
7542    \u0275\u0275listener("click", function TagAddedComponent_Conditional_7_Template_ui_button_click_0_listener() {
7543      \u0275\u0275restoreView(_r4);
7544      const ctx_r2 = \u0275\u0275nextContext();
7545      return \u0275\u0275resetView(ctx_r2.valueChange.emit());
7546    });
7547    \u0275\u0275elementEnd();
7548  }
7549  if (rf & 2) {
7550    \u0275\u0275property("label", \u0275\u0275pipeBind1(1, 1, "MESSENGER.TAGS.ADD_OTHER"));
7551  }
7552}
7553var TagAddedComponent = class _TagAddedComponent {
7554  store = inject(MessengerStore);
7555  valueChange = output();
7556  remove(id) {
7557    this.store.post().options.instagram.tagList.remove(id);
7558    if (this.store.post().options.instagram.tagList.isEmpty) {
7559      this.valueChange.emit();
7560    }
7561  }
7562  static \u0275fac = function TagAddedComponent_Factory(__ngFactoryType__) {
7563    return new (__ngFactoryType__ || _TagAddedComponent)();
7564  };
7565  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _TagAddedComponent, selectors: [["app-tag-added"]], outputs: { valueChange: "valueChange" }, decls: 8, vars: 4, consts: [[1, "size-full", "grid", "grid-rows-[auto_1fr_auto]", "gap-2"], [1, "font-sans", "font-medium", "text-sm", "text-grey-500"], [1, "overflow-y-auto"], [1, "flex", "items-center", "gap-4", "mb-3"], ["icon", "circlePlus", "severity", "contrast", 3, "label"], [1, "w-full", "flex", "items-center", "gap-3", "rounded-lg", "border", "border-grey-100", "px-3", "py-2", "bg-white"], ["size", "normal", "styleClass", "size-6!", 3, "image", "label"], [1, "block", "flex-1", "font-display", "text-sm", "font-semibold", "truncate"], ["name", "trash", "styleClass", "size-5! cursor-pointer text-grey-300", 3, "click"], ["icon", "circlePlus", "severity", "contrast", 3, "click", "label"]], template: function TagAddedComponent_Template(rf, ctx) {
7566    if (rf & 1) {
7567      \u0275\u0275elementStart(0, "article", 0)(1, "h3", 1);
7568      \u0275\u0275text(2);
7569      \u0275\u0275pipe(3, "translate");
7570      \u0275\u0275elementEnd();
7571      \u0275\u0275elementStart(4, "ul", 2);
7572      \u0275\u0275repeaterCreate(5, TagAddedComponent_For_6_Template, 6, 3, "li", 3, _forTrack03);
7573      \u0275\u0275elementEnd();
7574      \u0275\u0275conditionalCreate(7, TagAddedComponent_Conditional_7_Template, 2, 3, "ui-button", 4);
7575      \u0275\u0275elementEnd();
7576    }
7577    if (rf & 2) {
7578      \u0275\u0275advance(2);
7579      \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(3, 2, "MESSENGER.TAGS.ADDED_TITLE"), " ");
7580      \u0275\u0275advance(3);
7581      \u0275\u0275repeater(ctx.store.post().options.instagram.tagList.items);
7582      \u0275\u0275advance(2);
7583      \u0275\u0275conditional(ctx.store.post().options.instagram.tagList.canInsert ? 7 : -1);
7584    }
7585  }, dependencies: [CommonModule, TranslatePipe, AvatarComponent, IconComponent, ButtonComponent], encapsulation: 2 });
7586};
7587(() => {
7588  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TagAddedComponent, [{
7589    type: Component,
7590    args: [{ selector: "app-tag-added", imports: [CommonModule, TranslatePipe, AvatarComponent, IconComponent, ButtonComponent], template: `<article class="size-full grid grid-rows-[auto_1fr_auto] gap-2">
7591  <h3 class="font-sans font-medium text-sm text-grey-500">
7592    {{ 'MESSENGER.TAGS.ADDED_TITLE' | translate }}
7593  </h3>
7594
7595  <ul class="overflow-y-auto">
7596    @for (tag of store.post().options.instagram.tagList.items; track tag.username) {
7597    <li class="flex items-center gap-4 mb-3">
7598      <div class="w-full flex items-center gap-3 rounded-lg border border-grey-100 px-3 py-2 bg-white">
7599        <ui-avatar [image]="tag.photo" [label]="tag.username" size="normal" styleClass="size-6!" />
7600        <span class="block flex-1 font-display text-sm font-semibold truncate">{{ tag.username }}</span>
7601      </div>
7602
7603      <ui-icon (click)="remove(tag.username)" name="trash" styleClass="size-5! cursor-pointer text-grey-300" />
7604    </li>
7605    }
7606  </ul>
7607
7608  @if(store.post().options.instagram.tagList.canInsert ){
7609  <ui-button
7610    (click)="valueChange.emit()"
7611    [label]="'MESSENGER.TAGS.ADD_OTHER' | translate"
7612    icon="circlePlus"
7613    severity="contrast"
7614  />
7615  }
7616</article>
7617` }]
7618  }], null, null);
7619})();
7620(() => {
7621  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(TagAddedComponent, { className: "TagAddedComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/instagram/components/tags/components/tag-added/tag-added.component.ts", lineNumber: 12 });
7622})();
7623
7624// libs/socialgest/messenger/src/presenter/components/extras/instagram/components/tags/tags.component.ts
7625function TagsComponent_Conditional_5_Template(rf, ctx) {
7626  if (rf & 1) {
7627    const _r3 = \u0275\u0275getCurrentView();
7628    \u0275\u0275elementStart(0, "app-tag-added", 5);
7629    \u0275\u0275listener("valueChange", function TagsComponent_Conditional_5_Template_app_tag_added_valueChange_0_listener() {
7630      \u0275\u0275restoreView(_r3);
7631      const ctx_r3 = \u0275\u0275nextContext();
7632      return \u0275\u0275resetView(ctx_r3.mode.set("searcher"));
7633    });
7634    \u0275\u0275elementEnd();
7635  }
7636}
7637function TagsComponent_Conditional_6_Template(rf, ctx) {
7638  if (rf & 1) {
7639    const _r5 = \u0275\u0275getCurrentView();
7640    \u0275\u0275elementStart(0, "app-tag-searcher", 6);
7641    \u0275\u0275listener("valueChange", function TagsComponent_Conditional_6_Template_app_tag_searcher_valueChange_0_listener() {
7642      \u0275\u0275restoreView(_r5);
7643      const ctx_r3 = \u0275\u0275nextContext();
7644      return \u0275\u0275resetView(ctx_r3.mode.set("added"));
7645    });
7646    \u0275\u0275elementEnd();
7647  }
7648  if (rf & 2) {
7649    const ctx_r3 = \u0275\u0275nextContext();
7650    \u0275\u0275property("userList", ctx_r3.userList());
7651  }
7652}
7653var TagsComponent = class _TagsComponent {
7654  userList = input.required();
7655  store = inject(MessengerStore);
7656  mode = signal("searcher");
7657  ngOnInit() {
7658    if (this.store.post().options.instagram.tagList.isPresent) {
7659      this.mode.set("added");
7660    }
7661  }
7662  static \u0275fac = function TagsComponent_Factory(__ngFactoryType__) {
7663    return new (__ngFactoryType__ || _TagsComponent)();
7664  };
7665  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _TagsComponent, selectors: [["app-tags"]], inputs: { userList: [1, "userList"] }, decls: 7, vars: 11, consts: [["popover", ""], ["icon", "squareUser", 1, "curs
7665or-pointer", 3, "click", "variant", "severity", "tooltip", "tooltipPosition", "positionTop", "styleClass"], ["styleClass", "w-[19rem] -mt-5! no-gutter"], [1, "h-[21.5rem]", "p-5"], [3, "userList"], [3, "valueChange"], [3, "valueChange", "userList"]], template: function TagsComponent_Template(rf, ctx) {
7666    if (rf & 1) {
7667      const _r1 = \u0275\u0275getCurrentView();
7668      \u0275\u0275elementStart(0, "ui-button", 1);
7669      \u0275\u0275pipe(1, "translate");
7670      \u0275\u0275listener("click", function TagsComponent_Template_ui_button_click_0_listener($event) {
7671        \u0275\u0275restoreView(_r1);
7672        const popover_r2 = \u0275\u0275reference(3);
7673        return \u0275\u0275resetView(popover_r2.toggle($event));
7674      });
7675      \u0275\u0275elementEnd();
7676      \u0275\u0275elementStart(2, "ui-popover", 2, 0)(4, "article", 3);
7677      \u0275\u0275conditionalCreate(5, TagsComponent_Conditional_5_Template, 1, 0, "app-tag-added")(6, TagsComponent_Conditional_6_Template, 1, 1, "app-tag-searcher", 4);
7678      \u0275\u0275elementEnd()();
7679    }
7680    if (rf & 2) {
7681      const popover_r2 = \u0275\u0275reference(3);
7682      const hasTags_r6 = ctx.store.post().options.instagram.tagList.isPresent;
7683      \u0275\u0275property("styleClass", \u0275\u0275interpolate2("\n  ", popover_r2.isOpen() && "bg-grey-50!", "\n  ", hasTags_r6 && " bg-secondary-50!"))("variant", hasTags_r6 ? "outlined" : void 0)("severity", hasTags_r6 ? "secondary" : "contrast")("tooltip", \u0275\u0275pipeBind1(1, 9, "MESSENGER.TAGS.TITLE"))("tooltipPosition", "top")("positionTop", -10);
7684      \u0275\u0275advance(5);
7685      \u0275\u0275conditional(ctx.mode() === "added" ? 5 : 6);
7686    }
7687  }, dependencies: [
7688    CommonModule,
7689    TranslatePipe,
7690    PopoverComponent,
7691    ButtonComponent,
7692    TooltipDirective,
7693    TagSearcherComponent,
7694    TagAddedComponent
7695  ], encapsulation: 2 });
7696};
7697(() => {
7698  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TagsComponent, [{
7699    type: Component,
7700    args: [{ selector: "app-tags", imports: [
7701      CommonModule,
7702      TranslatePipe,
7703      PopoverComponent,
7704      ButtonComponent,
7705      TooltipDirective,
7706      TagSearcherComponent,
7707      TagAddedComponent
7708    ], template: `@let hasTags = store.post().options.instagram.tagList.isPresent;
7709
7710<ui-button
7711  (click)="popover.toggle($event)"
7712  icon="squareUser"
7713  [variant]="hasTags ? 'outlined' : undefined"
7714  [severity]="hasTags ? 'secondary' : 'contrast'"
7715  [tooltip]="'MESSENGER.TAGS.TITLE' | translate"
7716  [tooltipPosition]="'top'"
7717  [positionTop]="-10"
7718  class="cursor-pointer"
7719  styleClass="
7720  {{ popover.isOpen() && 'bg-grey-50!' }}
7721  {{ hasTags && ' bg-secondary-50!' }}"
7722/>
7723
7724<ui-popover #popover styleClass="w-[19rem] -mt-5! no-gutter">
7725  <article class="h-[21.5rem] p-5">
7726    @if(mode() === 'added'){
7727    <app-tag-added (valueChange)="mode.set('searcher')" />
7728    } @else {
7729    <app-tag-searcher (valueChange)="mode.set('added')" [userList]="userList()" />
7730    }
7731  </article>
7732</ui-popover>
7733` }]
7734  }], null, null);
7735})();
7736(() => {
7737  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(TagsComponent, { className: "TagsComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/instagram/components/tags/tags.component.ts", lineNumber: 21 });
7738})();
7739
7740// libs/socialgest/messenger/src/presenter/components/extras/instagram/components/audio/domain/audio-track.ts
7741var AudioTrack = class _AudioTrack extends Entity {
7742  title;
7743  artist;
7744  thumbnail;
7745  previewUrl;
7746  duration;
7747  igLink;
7748  constructor(id, title, artist, thumbnail, previewUrl, duration, igLink = "") {
7749    super(id);
7750    this.title = title;
7751    this.artist = artist;
7752    this.thumbnail = thumbnail;
7753    this.previewUrl = previewUrl;
7754    this.duration = duration;
7755    this.igLink = igLink;
7756  }
7757  static from(primitives) {
7758    return new _AudioTrack(primitives.id, primitives.title, primitives.artist, primitives.thumbnail, primitives.previewUrl, primitives.duration, primitives.igLink ?? "");
7759  }
7760};
7761
7762// libs/socialgest/messenger/src/presenter/components/extras/instagram/components/audio/domain/audio-track-list.ts
7763var AudioTrackList = class _AudioTrackList extends EntityList {
7764  tracks;
7765  constructor(tracks) {
7766    super(_AudioTrackList, tracks);
7767    this.tracks = tracks;
7768  }
7769  search(term) {
7770    const normalized = term.toLowerCase().trim();
7771    return this.filter((track) => track.title.toLowerCase().includes(normalized) || track.artist.toLowerCase().includes(normalized));
7772  }
7773  append(more) {
7774    const seen = new Set(this.tracks.map((t) => t.id));
7775    const deduped = more.filter((t) => !seen.has(t.id));
7776    return _AudioTrackList.from([...this.tracks, ...deduped]);
7777  }
7778  static from(tracks) {
7779    return new _AudioTrackList(tracks);
7780  }
7781  static empty() {
7782    return new _AudioTrackList([]);
7783  }
7784};
7785
7786// libs/socialgest/messenger/src/presenter/components/extras/instagram/components/audio/mappers/audio-track.mapper.ts
7787var AudioTrackMapper = class {
7788  static toDomain(entities) {
7789    return entities.map((entity) => AudioTrack.from({
7790      id: entity.audio_id,
7791      title: entity.title ?? "",
7792      artist: entity.display_artist ?? entity.ig_username ?? "",
7793      thumbnail: entity.cover_artwork_thumbnail_uri ?? "",
7794      previewUrl: entity.download_url ?? "",
7795      duration: entity.duration_in_ms ?? 0,
7796      igLink: entity.on_platform_audio_preview_link ?? ""
7797    }));
7798  }
7799};
7800
7801// libs/socialgest/messenger/src/presenter/components/extras/instagram/components/audio/services/audio-error.service.ts
7802var MAP_ERRORS6 = {
7803  3: () => "GLOBAL.ERROR.PERMISSION_DENIED",
7804  422: () => "MESSENGER.INSTAGRAM.AUDIO_ERROR.USER_NOT_INSTAGRAM",
7805  504: () => "MESSENGER.ERROR.TIMEOUT",
7806  1010: () => "MESSENGER.ERROR.RATE_LIMIT"
7807};
7808var from4 = (response) => {
7809  return new Exception(MAP_ERRORS6[response.error?.meta?.code]?.() ?? "GLOBAL.ERROR.UNEXPECTED");
7810};
7811
7812// libs/socialgest/messenger/src/presenter/components/extras/instagram/components/audio/services/audio.service.ts
7813var AudioService = class _AudioService {
7814  http;
7815  constructor(http) {
7816    this.http = http;
7817  }
7818  search(userId, options = {}) {
7819    const params = {};
7820    if (options.searchQuery)
7821      params["search_query"] = options.searchQuery;
7822    if (options.after)
7823      params["after"] = options.after;
7824    if (options.limit)
7825      params["limit"] = String(options.limit);
7826    if (options.audioType)
7827      params["audio_type"] = options.audioType;
7828    return this.http.get(`${environment.apiUrlV1}instagram_business/audio_library/${userId}`, { params }).pipe(map((response) => esm_exports.right({
7829      tracks: AudioTrackMapper.toDomain(response?.data?.list ?? []),
7830      nextCursor: response?.data?.next_cursor ?? null
7831    })), catchError((err) => of(esm_exports.left(from4(err)))));
7832  }
7833  static \u0275fac = function AudioService_Factory(__ngFactoryType__) {
7834    return new (__ngFactoryType__ || _AudioService)(\u0275\u0275inject(HttpClient));
7835  };
7836  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _AudioService, factory: _AudioService.\u0275fac, providedIn: "root" });
7837};
7838(() => {
7839  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(AudioService, [{
7840    type: Injectable,
7841    args: [{ providedIn: "root" }]
7842  }], () => [{ type: HttpClient }], null);
7843})();
7844
7845// libs/socialgest/messenger/src/presenter/components/extras/instagram/components/audio/components/audio-dialog/services/audio-player.service.ts
7846var AudioPlayerService = class _AudioPlayerService {
7847  audio = new Audio();
7848  playingId = signal(null);
7849  constructor() {
7850    this.audio.addEventListener("ended", () => this.playingId.set(null));
7851  }
7852  toggle(id, url) {
7853    if (this.playingId() === id) {
7854      this.audio.pause();
7855      this.playingId.set(null);
7856    } else {
7857      this.audio.src = url;
7858      this.audio.play();
7859      this.playingId.set(id);
7860    }
7861  }
7862  stopIfPlaying(id) {
7863    if (this.playingId() === id) {
7864      this.audio.pause();
7865      this.playingId.set(null);
7866    }
7867  }
7868  ngOnDestroy() {
7869    this.audio.pause();
7870  }
7871  static \u0275fac = function AudioPlayerService_Factory(__ngFactoryType__) {
7872    return new (__ngFactoryType__ || _AudioPlayerService)();
7873  };
7874  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _AudioPlayerService, factory: _AudioPlayerService.\u0275fac });
7875};
7876(() => {
7877  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(AudioPlayerService, [{
7878    type: Injectable
7879  }], () => [], null);
7880})();
7881
7882// libs/socialgest/messenger/src/presenter/components/extras/instagram/components/audio/components/audio-dialog/components/audio-search/components/audio-selected-track/audio-selected-track.component.ts
7883function AudioSelectedTrackComponent_Conditional_2_Template(rf, ctx) {
7884  if (rf & 1) {
7885    \u0275\u0275element(0, "img", 2);
7886  }
7887  if (rf & 2) {
7888    const ctx_r0 = \u0275\u0275nextContext();
7889    \u0275\u0275property("src", ctx_r0.track().thumbnail, \u0275\u0275sanitizeUrl);
7890  }
7891}
7892var AudioSelectedTrackComponent = class _AudioSelectedTrackComponent {
7893  track = input.required();
7894  edit = output();
7895  remove = output();
7896  static \u0275fac = function AudioSelectedTrackComponent_Factory(__ngFactoryType__) {
7897    return new (__ngFactoryType__ || _AudioSelectedTrackComponent)();
7898  };
7899  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _AudioSelectedTrackComponent, selectors: [["app-audio-selected-track"]], inputs: { track: [1, "track"] }, outputs: { edit: "edit", remove: "remove" }, decls: 15, vars: 15, consts: [[1, "flex", "items-center", "gap-4", "px-3", "py-2"], [1, "size-11", "rounded-md", "bg-grey-100", "overflow-hidden", "flex-shrink-0"], ["alt", "Audio cover", 1, "size-full", "object-cover", 3, "src"], [1, "flex-1", "min-w-0", "space-y-1"], [1, "text-sm", "font-semibold", "truncate", "font-display"], [1, "text-xs", "text-grey-500", "font-medium", "font-display"], ["tooltipPosition", "top", "severity", "contrast", "size", "small", 3, "click", "label", "tooltip", "fluid"], [1, "cursor-pointer", "text-grey-500", 3, "click"], ["name", "circleX", 3, "size"], [1, "border-grey-50", "mb-3"]], template: function AudioSelectedTrackComponent_Template(rf, ctx) {
7900    if (rf & 1) {
7901      \u0275\u0275elementStart(0, "div", 0)(1, "div", 1);
7902      \u0275\u0275conditionalCreate(2, AudioSelectedTrackComponent_Conditional_2_Template, 1, 1, "img", 2);
7903      \u0275\u0275elementEnd();
7904      \u0275\u0275elementStart(3, "div", 3)(4, "p", 4);
7905      \u0275\u0275text(5);
7906      \u0275\u0275elementEnd();
7907      \u0275\u0275elementStart(6, "p", 5);
7908      \u0275\u0275text(7);
7909      \u0275\u0275pipe(8, "formatDuration");
7910      \u0275\u0275elementEnd()();
7911      \u0275\u0275elementStart(9, "ui-button", 6);
7912      \u0275\u0275pipe(10, "translate");
7913      \u0275\u0275pipe(11, "translate");
7914      \u0275\u0275listener("click", function AudioSelectedTrackComponent_Template_ui_button_click_9_listener() {
7915        return ctx.edit.emit();
7916      });
7917      \u0275\u0275elementEnd();
7918      \u0275\u0275elementStart(12, "button", 7);
7919      \u0275\u0275listener("click", function AudioSelectedTrackComponent_Template_button_click_12_listener() {
7920        return ctx.remove.emit();
7921      });
7922      \u0275\u0275element(13, "ui-icon", 8);
7923      \u0275\u0275elementEnd()();
7924      \u0275\u0275element(14, "hr", 9);
7925    }
7926    if (rf & 2) {
7927      \u0275\u0275advance(2);
7928      \u0275\u0275conditional(ctx.track().thumbnail ? 2 : -1);
7929      \u0275\u0275advance(3);
7930      \u0275\u0275textInterpolate(ctx.track().title);
7931      \u0275\u0275advance(2);
7932      \u0275\u0275textInterpolate2(" ", \u0275\u0275pipeBind2(8, 8, ctx.track().duration, "milliseconds"), " \xB7 ", ctx.track().artist, " ");
7933      \u0275\u0275advance(2);
7934      \u0275\u0275property("label", \u0275\u0275pipeBind1(10, 11, "MESSENGER.INSTAGRAM.AUDIO_EDIT"))("tooltip", \u0275\u0275pipeBind1(11, 13, "MESSENGER.INSTAGRAM.AUDIO_EDIT_VIDEO_TOOLTIP"))("fluid", false);
7935      \u0275\u0275advance(4);
7936      \u0275\u0275property("size", 18);
7937    }
7938  }, dependencies: [TranslatePipe, FormatDurationPipe, ButtonComponent, IconComponent, TooltipDirective], encapsulation: 2 });
7939};
7940(() => {
7941  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(AudioSelectedTrackComponent, [{
7942    type: Component,
7943    args: [{ selector: "app-audio-selected-track", imports: [TranslatePipe, FormatDurationPipe, ButtonComponent, IconComponent, TooltipDirective], template: `<div class="flex items-center gap-4 px-3 py-2">
7944  <div class="size-11 rounded-md bg-grey-100 overflow-hidden flex-shrink-0">
7945    @if (track().thumbnail) {
7946    <img [src]="track().thumbnail" class="size-full object-cover" alt="Audio cover" />
7947    }
7948  </div>
7949
7950  <div class="flex-1 min-w-0 space-y-1">
7951    <p class="text-sm font-semibold truncate font-display">{{ track().title }}</p>
7952    <p class="text-xs text-grey-500 font-medium font-display">
7953      {{ track().duration | formatDuration : 'milliseconds' }} \xB7 {{ track().artist }}
7954    </p>
7955  </div>
7956
7957  <ui-button
7958    (click)="edit.emit()"
7959    [label]="'MESSENGER.INSTAGRAM.AUDIO_EDIT' | translate"
7960    [tooltip]="'MESSENGER.INSTAGRAM.AUDIO_EDIT_VIDEO_TOOLTIP' | translate"
7961    tooltipPosition="top"
7962    severity="contrast"
7963    size="small"
7964    [fluid]="false"
7965  />
7966
7967  <button (click)="remove.emit()" class="cursor-pointer text-grey-500">
7968    <ui-icon name="circleX" [size]="18" />
7969  </button>
7970</div>
7971
7972<hr class="border-grey-50 mb-3" />
7973` }]
7974  }], null, null);
7975})();
7976(() => {
7977  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(AudioSelectedTrackComponent, { className: "AudioSelectedTrackComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/instagram/components/
7977audio/components/audio-dialog/components/audio-search/components/audio-selected-track/audio-selected-track.component.ts", lineNumber: 11 });
7978})();
7979
7980// libs/socialgest/messenger/src/presenter/components/extras/instagram/components/audio/components/audio-dialog/components/audio-search/components/audio-track-item/audio-track-item.component.ts
7981function AudioTrackItemComponent_Conditional_1_Template(rf, ctx) {
7982  if (rf & 1) {
7983    \u0275\u0275elementStart(0, "div", 1);
7984    \u0275\u0275element(1, "img", 7);
7985    \u0275\u0275elementEnd();
7986  }
7987  if (rf & 2) {
7988    const ctx_r0 = \u0275\u0275nextContext();
7989    \u0275\u0275advance();
7990    \u0275\u0275property("src", ctx_r0.track().thumbnail, \u0275\u0275sanitizeUrl)("alt", ctx_r0.track().title);
7991  }
7992}
7993function AudioTrackItemComponent_Conditional_8_Template(rf, ctx) {
7994  if (rf & 1) {
7995    const _r2 = \u0275\u0275getCurrentView();
7996    \u0275\u0275elementStart(0, "button", 8);
7997    \u0275\u0275listener("click", function AudioTrackItemComponent_Conditional_8_Template_button_click_0_listener($event) {
7998      \u0275\u0275restoreView(_r2);
7999      const ctx_r0 = \u0275\u0275nextContext();
8000      $event.stopPropagation();
8001      return \u0275\u0275resetView(ctx_r0.toggle());
8002    });
8003    \u0275\u0275element(1, "ui-icon", 9);
8004    \u0275\u0275elementEnd();
8005  }
8006  if (rf & 2) {
8007    const ctx_r0 = \u0275\u0275nextContext();
8008    \u0275\u0275advance();
8009    \u0275\u0275property("name", ctx_r0.isPlaying() ? "pause" : "play")("size", 20);
8010  }
8011}
8012function AudioTrackItemComponent_Conditional_9_Template(rf, ctx) {
8013  if (rf & 1) {
8014    const _r3 = \u0275\u0275getCurrentView();
8015    \u0275\u0275elementStart(0, "a", 10);
8016    \u0275\u0275listener("click", function AudioTrackItemComponent_Conditional_9_Template_a_click_0_listener($event) {
8017      \u0275\u0275restoreView(_r3);
8018      return \u0275\u0275resetView($event.stopPropagation());
8019    });
8020    \u0275\u0275element(1, "ui-icon", 11);
8021    \u0275\u0275elementEnd();
8022  }
8023  if (rf & 2) {
8024    const ctx_r0 = \u0275\u0275nextContext();
8025    \u0275\u0275property("href", ctx_r0.track().igLink, \u0275\u0275sanitizeUrl);
8026    \u0275\u0275advance();
8027    \u0275\u0275property("size", 18);
8028  }
8029}
8030var AudioTrackItemComponent = class _AudioTrackItemComponent {
8031  track = input.required();
8032  selected = input(false);
8033  select = output();
8034  player = inject(AudioPlayerService);
8035  hasPreview = computed(() => !!this.track().previewUrl);
8036  hasIgLink = computed(() => !!this.track().igLink);
8037  isPlaying = computed(() => this.player.playingId() === this.track().id);
8038  toggle() {
8039    if (!this.hasPreview())
8040      return;
8041    this.player.toggle(this.track().id, this.track().previewUrl);
8042  }
8043  ngOnDestroy() {
8044    this.player.stopIfPlaying(this.track().id);
8045  }
8046  static \u0275fac = function AudioTrackItemComponent_Factory(__ngFactoryType__) {
8047    return new (__ngFactoryType__ || _AudioTrackItemComponent)();
8048  };
8049  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _AudioTrackItemComponent, selectors: [["app-audio-track-item"]], inputs: { track: [1, "track"], selected: [1, "selected"] }, outputs: { select: "select" }, decls: 10, vars: 13, consts: [["tabindex", "0", "role", "option", 1, "flex", "items-center", "gap-4", "px-3", "py-2.5", "rounded-lg", "cursor-pointer", "transition-colors", 3, "click", "keydown.enter", "keydown.space"], [1, "size-11", "rounded-md", "bg-grey-100", "overflow-hidden", "flex-shrink-0"], [1, "flex-1", "min-w-0", "space-y-1"], [1, "text-sm", "font-semibold", "truncate", "font-display"], [1, "text-xs", "text-grey-500", "font-medium", "font-display"], [1, "cursor-pointer", "text-grey-500"], ["target", "_blank", "rel", "noopener noreferrer", 1, "curs
8049or-pointer", "text-grey-500", 3, "href"], [1, "size-full", "object-cover", 3, "src", "alt"], [1, "cursor-pointer", "text-grey-500", 3, "click"], [3, "name", "size"], ["target", "_blank", "rel", "noopener noreferrer", 1, "cursor-pointer", "text-grey-500", 3, "click", "href"], ["name", "externalLink", 3, "size"]], template: function AudioTrackItemComponent_Template(rf, ctx) {
8050    if (rf & 1) {
8051      \u0275\u0275elementStart(0, "li", 0);
8052      \u0275\u0275listener("click", function AudioTrackItemComponent_Template_li_click_0_listener() {
8053        return ctx.select.emit();
8054      })("keydown.enter", function AudioTrackItemComponent_Template_li_keydown_enter_0_listener() {
8055        return ctx.select.emit();
8056      })("keydown.space", function AudioTrackItemComponent_Template_li_keydown_space_0_listener($event) {
8057        $event.preventDefault();
8058        return ctx.select.emit();
8059      });
8060      \u0275\u0275conditionalCreate(1, AudioTrackItemComponent_Conditional_1_Template, 2, 2, "div", 1);
8061      \u0275\u0275elementStart(2, "div", 2)(3, "p", 3);
8062      \u0275\u0275text(4);
8063      \u0275\u0275elementEnd();
8064      \u0275\u0275elementStart(5, "p", 4);
8065      \u0275\u0275text(6);
8066      \u0275\u0275pipe(7, "formatDuration");
8067      \u0275\u0275elementEnd()();
8068      \u0275\u0275conditionalCreate(8, AudioTrackItemComponent_Conditional_8_Template, 2, 2, "button", 5)(9, AudioTrackItemComponent_Conditional_9_Template, 2, 2, "a", 6);
8069      \u0275\u0275elementEnd();
8070    }
8071    if (rf & 2) {
8072      \u0275\u0275classProp("bg-secondary-50", ctx.selected())("hover:bg-grey-50", !ctx.selected());
8073      \u0275\u0275attribute("aria-selected", ctx.selected());
8074      \u0275\u0275advance();
8075      \u0275\u0275conditional(ctx.track().thumbnail ? 1 : -1);
8076      \u0275\u0275advance(3);
8077      \u0275\u0275textInterpolate(ctx.track().title);
8078      \u0275\u0275advance(2);
8079      \u0275\u0275textInterpolate2(" ", \u0275\u0275pipeBind2(7, 10, ctx.track().duration, "milliseconds"), " \xB7 ", ctx.track().artist, " ");
8080      \u0275\u0275advance(2);
8081      \u0275\u0275conditional(ctx.hasPreview() ? 8 : ctx.hasIgLink() ? 9 : -1);
8082    }
8083  }, dependencies: [FormatDurationPipe, IconComponent], encapsulation: 2 });
8084};
8085(() => {
8086  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(AudioTrackItemComponent, [{
8087    type: Component,
8088    args: [{ selector: "app-audio-track-item", imports: [FormatDurationPipe, IconComponent], template: `<li
8089  (click)="select.emit()"
8090  (keydown.enter)="select.emit()"
8091  (keydown.space)="$event.preventDefault(); select.emit()"
8092  tabindex="0"
8093  role="option"
8094  [attr.aria-selected]="selected()"
8095  class="flex items-center gap-4 px-3 py-2.5 rounded-lg cursor-pointer transition-colors"
8096  [class.bg-secondary-50]="selected()"
8097  [class.hover:bg-grey-50]="!selected()"
8098>
8099  @if (track().thumbnail) {
8100  <div class="size-11 rounded-md bg-grey-100 overflow-hidden flex-shrink-0">
8101    <img [src]="track().thumbnail" class="size-full object-cover" [alt]="track().title" />
8102  </div>
8103  }
8104
8105  <div class="flex-1 min-w-0 space-y-1">
8106    <p class="text-sm font-semibold truncate font-display">{{ track().title }}</p>
8107    <p class="text-xs text-grey-500 font-medium font-display">
8108      {{ track().duration | formatDuration : 'milliseconds' }} \xB7 {{ track().artist }}
8109    </p>
8110  </div>
8111
8112  @if (hasPreview()) {
8113  <button (click)="$event.stopPropagation(); toggle()" class="cursor-pointer text-grey-500">
8114    <ui-icon [name]="isPlaying() ? 'pause' : 'play'" [size]="20" />
8115  </button>
8116  } @else if (hasIgLink()) {
8117  <a
8118    [href]="track().igLink"
8119    target="_blank"
8120    rel="noopener noreferrer"
8121    (click)="$event.stopPropagation()"
8122    class="cursor-pointer text-grey-500"
8123  >
8124    <ui-icon name="externalLink" [size]="18" />
8125  </a>
8126  }
8127</li>
8128` }]
8129  }], null, null);
8130})();
8131(() => {
8132  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(AudioTrackItemComponent, { className: "AudioTrackItemComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/instagram/components/audio/components/audio-dialog/components/audio-search/components/audio-track-item/audio-track-item.component.ts", lineNumber: 12 });
8133})();
8134
8135// libs/socialgest/messenger/src/presenter/components/extras/instagram/components/audio/components/audio-dialog/components/audio-search/audio-search.component.ts
8136var _forTrack04 = ($index, $item) => $item.id;
8137function AudioSearchComponent_Conditional_9_Template(rf, ctx) {
8138  if (rf & 1) {
8139    const _r1 = \u0275\u0275getCurrentView();
8140    \u0275\u0275elementStart(0, "app-audio-selected-track", 9);
8141    \u0275\u0275listener("edit", function AudioSearchComponent_Conditional_9_Template_app_audio_selected_track_edit_0_listener() {
8142      \u0275\u0275restoreView(_r1);
8143      const ctx_r1 = \u0275\u0275nextContext();
8144      return \u0275\u0275resetView(ctx_r1.goToEdit.emit());
8145    })("remove", function AudioSearchComponent_Conditional_9_Template_app_audio_selected_track_remove_0_listener() {
8146      \u0275\u0275restoreView(_r1);
8147      const ctx_r1 = \u0275\u0275nextContext();
8148      return \u0275\u0275resetView(ctx_r1.trackSelected.emit(null));
8149    });
8150    \u0275\u0275elementEnd();
8151  }
8152  if (rf & 2) {
8153    const ctx_r1 = \u0275\u0275nextContext();
8154    \u0275\u0275property("track", ctx_r1.selectedTrack());
8155  }
8156}
8157function AudioSearchComponent_Conditional_10_For_2_Template(rf, ctx) {
8158  if (rf & 1) {
8159    const _r4 = \u0275\u0275getCurrentView();
8160    \u0275\u0275elementStart(0, "app-audio-track-item", 13);
8161    \u0275\u0275listener("select", function AudioSearchComponent_Conditional_10_For_2_Template_app_audio_track_item_select_0_listener() {
8162      const t_r5 = \u0275\u0275restoreView(_r4).$implicit;
8163      const ctx_r1 = \u0275\u0275nextContext(2);
8164      return \u0275\u0275resetView(ctx_r1.trackSelected.emit(t_r5));
8165    });
8166    \u0275\u0275elementEnd();
8167  }
8168  if (rf & 2) {
8169    let tmp_12_0;
8170    const t_r5 = ctx.$implicit;
8171    const ctx_r1 = \u0275\u0275nextContext(2);
8172    \u0275\u0275property("track", t_r5)("selected", ((tmp_12_0 = ctx_r1.selectedTrack()) == null ? null : tmp_12_0.id) === t_r5.id);
8173  }
8174}
8175function AudioSearchComponent_Conditional_10_Conditional_3_Template(rf, ctx) {
8176  if (rf & 1) {
8177    \u0275\u0275elementStart(0, "li", 12);
8178    \u0275\u0275text(1);
8179    \u0275\u0275pipe(2, "translate");
8180    \u0275\u0275elementEnd();
8181  }
8182  if (rf & 2) {
8183    \u0275\u0275advance();
8184    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(2, 1, "GLOBAL.PROGRESS.LOADING"), " ");
8185  }
8186}
8187function AudioSearchComponent_Conditional_10_Template(rf, ctx) {
8188  if (rf & 1) {
8189    const _r3 = \u0275\u0275getCurrentView();
8190    \u0275\u0275elementStart(0, "ul", 10);
8191    \u0275\u0275listener("scrolled", function AudioSearchComponent_Conditional_10_Template_ul_scrolled_0_listener() {
8192      \u0275\u0275restoreView(_r3);
8193      const ctx_r1 = \u0275\u0275nextContext();
8194      return \u0275\u0275resetView(ctx_r1.loadMore());
8195    });
8196    \u0275\u0275repeaterCreate(1, AudioSearchComponent_Conditional_10_For_2_Template, 1, 2, "app-audio-track-item", 11, _forTrack04);
8197    \u0275\u0275conditionalCreate(3, AudioSearchComponent_Conditional_10_Conditional_3_Template, 3, 3, "li", 12);
8198    \u0275\u0275elementEnd();
8199  }
8200  if (rf & 2) {
8201    const ctx_r1 = \u0275\u0275nextContext();
8202    \u0275\u0275property("infiniteScrollDistance", 2)("infiniteScrollThrottle", 300)("scrollWindow", false)("infiniteScrollDisabled", !ctx_r1.hasMore() || ctx_r1.isLoadingMore());
8203    \u0275\u0275advance();
8204    \u0275\u0275repeater(ctx_r1.tracks().items);
8205    \u0275\u0275advance(2);
8206    \u0275\u0275conditional(ctx_r1.isLoadingMore() ? 3 : -1);
8207  }
8208}
8209function AudioSearchComponent_Conditional_11_Template(rf, ctx) {
8210  if (rf & 1) {
8211    \u0275\u0275elementStart(0, "div", 8);
8212    \u0275\u0275element(1, "ui-empty-list", 14);
8213    \u0275\u0275elementEnd();
8214  }
8215  if (rf & 2) {
8216    const ctx_r1 = \u0275\u0275nextContext();
8217    \u0275\u0275advance();
8218    \u0275\u0275property("hasItems", true)("noResultsLabel", "GLOBAL.EMPTY.NO_RESULTS_LIST_TITLE")("noResultsDescription", "GLOBAL.EMPTY.NO_RESULTS_LIST_DESC")("isScreenView", false)("isLoading", ctx_r1.isLoading())("width", "100%")("height", "100%");
8219  }
8220}
8221var AudioSearchComponent = class _AudioSearchComponent {
8222  userList = input.required();
8223  selectedTrack = input(null);
8224  filterAudioType = input("music");
8225  trackSelected = output();
8226  goToFilter = output();
8227  goToEdit = output();
8228  audioService = inject(AudioService);
8229  toast = inject(SonnerToasterService);
8230  tracks = signal(AudioTrackList.empty());
8231  isLoading = signal(false);
8232  isLoadingMore = signal(false);
8233  searchQuery = signal("");
8234  nextCursor = signal(null);
8235  hasMore = computed(() =>
8235 this.nextCursor() !== null);
8236  userId = computed(() => String(this.userList().first?.id ?? ""));
8237  constructor() {
8238    effect(() => {
8239      const query = this.searchQuery();
8240      const audioType = this.filterAudioType();
8241      const id = this.userId();
8242      if (id)
8243        this.search(id, query, audioType);
8244    });
8245  }
8246  loadMore() {
8247    const cursor = this.nextCursor();
8248    const id = this.userId();
8249    if (!cursor || !id || this.isLoadingMore() || this.isLoading())
8250      return;
8251    this.isLoadingMore.set(true);
8252    this.audioService.search(id, {
8253      searchQuery: this.searchQuery() || void 0,
8254      audioType: this.filterAudioType(),
8255      after: cursor
8256    }).subscribe((result) => {
8257      result.mapRight(({ tracks, nextCursor }) => {
8258        this.tracks.update((current) => current.append(tracks));
8259        this.nextCursor.set(nextCursor);
8260      }).mapLeft((err) => this.toast.error(new Exception(err.message)));
8261      this.isLoadingMore.set(false);
8262    });
8263  }
8264  search(userId, searchQuery, audioType) {
8265    this.isLoading.set(true);
8266    this.nextCursor.set(null);
8267    this.audioService.search(userId, { searchQuery: searchQuery || void 0, audioType }).subscribe((result) => {
8268      result.mapRight(({ tracks, nextCursor }) => {
8269        this.tracks.set(AudioTrackList.from(tracks));
8270        this.nextCursor.set(nextCursor);
8271      }).mapLeft((err) => this.toast.error(new Exception(err.message)));
8272      this.isLoading.set(false);
8273    });
8274  }
8275  static \u0275fac = function AudioSearchComponent_Factory(__ngFactoryType__) {
8276    return new (__ngFactoryType__ || _AudioSearchComponent)();
8277  };
8278  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _AudioSearchComponent, selectors: [["app-audio-search"]], inputs: { userList: [1, "userList"], selectedTrack: [1, "selectedTrack"], filterAudioType: [1, "filterAudioType"] }, outputs: { trackSelected: "trackSelected", goToFilter: "goToFilter", goToEdit: "goToEdit" }, features: [\u0275\u0275ProvidersFeature([AudioPlayerService])], decls: 12, vars: 8, consts: [[1, "w-[28rem]", "h-[33rem]", "flex", "flex-col", "gap-4", "p-5", "pb-2"], [1, "flex", "items-center", "justify-between"], [1, "text-base", "font-semibold"], [1, "flex", "items-center", "gap-3"], ["size", "small", 1, "w-full", 3, "valueChange", "placeholder"], ["icon", "listFilter", "severity", "contrast", "styleClass", "size-9! aspect-square", 3, "click"], [3, "track"], ["infiniteScroll", "", 1, "flex-1", "overflow-y-auto", 3, "infiniteScrollDistance", "infiniteScrollThrottle", "scrollWindow", "infiniteScrollDisabled"], [1, "flex-1"], [3, "edit", "remove", "track"], ["infiniteScroll", "", 1, "flex-1", "overflow-y-auto", 3, "scrolled", "infiniteScrollDistance", "infiniteScrollThrottle", "scrollWindow", "infiniteScrollDisabled"], [3, "track", "selected"], [1, "py-3", "text-center", "text-xs", "text-grey-500"], [3, "select", "track", "selected"], ["emptyTitleStyleClass", "text-md! px-0!", "emptyDescriptionStyleClass", "text-sm! px-0!", "emptyStyleClass", "gap-2! mt-20!", "iconStyleClass", "size-16!", 3, "hasItems", "noResultsLabel", "noResultsDescription", "isScreenView", "isLoading", "width", "height"]], template: function AudioSearchComponent_Template(rf, ctx) {
8279    if (rf & 1) {
8280      \u0275\u0275elementStart(0, "article", 0)(1, "header", 1)(2, "h2", 2);
8281      \u0275\u0275text(3);
8282      \u0275\u0275pipe(4, "translate");
8283      \u0275\u0275elementEnd()();
8284      \u0275\u0275elementStart(5, "div", 3)(6, "ui-input-search", 4);
8285      \u0275\u0275pipe(7, "translate");
8286      \u0275\u0275listener("valueChange", function AudioSearchComponent_Template_ui_input_search_valueChange_6_listener($event) {
8287        return ctx.searchQuery.set($event);
8288      });
8289      \u0275\u0275elementEnd();
8290      \u0275\u0275elementStart(8, "ui-button", 5);
8291      \u0275\u0275listener("click", function AudioSearchComponent_Template_ui_button_click_8_listener() {
8292        return ctx.goToFilter.emit();
8293      });
8294      \u0275\u0275elementEnd()();
8295      \u0275\u0275conditionalCreate(9, AudioSearchComponent_Conditional_9_Template, 1, 1, "app-audio-selected-track", 6);
8296      \u0275\u0275conditionalCreate(10, AudioSearchComponent_Conditional_10_Template, 4, 5, "ul", 7)(11, AudioSearchComponent_Conditional_11_Template, 2, 7, "div", 8);
8297      \u0275\u0275elementEnd();
8298    }
8299    if (rf & 2) {
8300      \u0275\u0275advance(3);
8301      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 4, "MESSENGER.INSTAGRAM.AUDIO_ADD"));
8302      \u0275\u0275advance(3);
8303      \u0275\u0275property("placeholder", \u0275\u0275pipeBind1(7, 6, "MESSENGER.INSTAGRAM.AUDIO_SEARCH_PLACEHOLDER"));
8304      \u0275\u0275advance(3);
8305      \u0275\u0275conditional(ctx.selectedTrack() ? 9 : -1);
8306      \u0275\u0275advance();
8307      \u0275\u0275conditional(!ctx.isLoading() && ctx.tracks().length > 0 ? 10 : 11);
8308    }
8309  }, dependencies: [
8310    InfiniteScrollDirective,
8311    TranslatePipe,
8312    ButtonComponent,
8313    EmptyListComponent,
8314    InputSearchComponent,
8315    AudioSelectedTrackComponent,
8316    AudioTrackItemComponent
8317  ], encapsulation: 2 });
8318};
8319(() => {
8320  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(AudioSearchComponent, [{
8321    type: Component,
8322    args: [{ selector: "app-audio-search", imports: [
8323      InfiniteScrollDirective,
8324      TranslatePipe,
8325      ButtonComponent,
8326      EmptyListComponent,
8327      InputSearchComponent,
8328      AudioSelectedTrackComponent,
8329      AudioTrackItemComponent
8330    ], providers: [AudioPlayerService], template: `<article class="w-[28rem] h-[33rem] flex flex-col gap-4 p-5 pb-2">
8331  <header class="flex items-center justify-between">
8332    <h2 class="text-base font-semibold">{{ 'MESSENGER.INSTAGRAM.AUDIO_ADD' | translate }}</h2>
8333  </header>
8334
8335  <div class="flex items-center gap-3">
8336    <ui-input-search
8337      (valueChange)="searchQuery.set($event)"
8338      [placeholder]="'MESSENGER.INSTAGRAM.AUDIO_SEARCH_PLACEHOLDER' | translate"
8339      size="small"
8340      class="w-full"
8341    />
8342    <ui-button (click)="goToFilter.emit()" icon="listFilter" severity="contrast" styleClass="size-9! aspect-square" />
8343  </div>
8344
8345  @if (selectedTrack()) {
8346  <app-audio-selected-track (edit)="goToEdit.emit()" (remove)="trackSelected.emit(null)" [track]="selectedTrack()!" />
8347  } @if (!isLoading() && tracks().length > 0) {
8348  <ul
8349    class="flex-1 overflow-y-auto"
8350    infiniteScroll
8351    (scrolled)="loadMore()"
8352    [infiniteScrollDistance]="2"
8353    [infiniteScrollThrottle]="300"
8354    [scrollWindow]="false"
8355    [infiniteScrollDisabled]="!hasMore() || isLoadingMore()"
8356  >
8357    @for (t of tracks().items; track t.id) {
8358    <app-audio-track-item (select)="trackSelected.emit(t)" [track]="t" [selected]="selectedTrack()?.id === t.id" />
8359    } @if (isLoadingMore()) {
8360    <li class="py-3 text-center text-xs text-grey-500">
8361      {{ 'GLOBAL.PROGRESS.LOADING' | translate }}
8362    </li>
8363    }
8364  </ul>
8365  } @else {
8366  <div class="flex-1">
8367    <ui-empty-list
8368      [hasItems]="true"
8369      [noResultsLabel]="'GLOBAL.EMPTY.NO_RESULTS_LIST_TITLE'"
8370      [noResultsDescription]="'GLOBAL.EMPTY.NO_RESULTS_LIST_DESC'"
8371      [isScreenView]="false"
8372      [isLoading]="isLoading()"
8373      [width]="'100%'"
8374      [height]="'100%'"
8375      emptyTitleStyleClass="text-md! px-0!"
8376      emptyDescriptionStyleClass="text-sm! px-0!"
8377      emptyStyleClass="gap-2! mt-20!"
8378      iconStyleClass="size-16!"
8379    />
8380  </div>
8381  }
8382</article>
8383` }]
8384  }], () => [], null);
8385})();
8386(() => {
8387  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(AudioSearchComponent, { className: "AudioSearchComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/instagram/components/audio/components/audio-dialog/components/audio-search/audio-search.component.ts", lineNumber: 26 });
8388})();
8389
8390// libs/socialgest/messenger/src/presenter/components/extras/instagram/components/audio/components/audio-dialog/components/audio-edit/components/audio-slider/audio-slider.component.ts
8391var AudioSliderComponent = class _AudioSliderComponent {
8392  value = input.required();
8393  icon = input.required();
8394  label = input.required();
8395  max = input(100);
8396  valueChange = output();
8397  onSliderClick(event) {
8398    const track = event.currentTarget;
8399    const rect = track.getBoundingClientRect();
8400    const percent = Math.max(0, Math.min(1, (event.clientX - rect.left) / rect.width));
8401    this.valueChange.emit(Math.round(percent * this.max()));
8402  }
8403  onThumbDrag(event) {
8404    event.preventDefault();
8405    const track = event.target.parentElement;
8406    const rect = track.getBoundingClientRect();
8407    const onMove = (e) => {
8408      const percent = Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width));
8409      this.valueChange.emit(Math.round(percent * this.max()));
8410    };
8411    const onUp = () => {
8412      document.removeEventListener("mousemove", onMove);
8413      document.removeEventListener("mouseup", onUp);
8414    };
8415    document.addEventListener("mousemove", onMove);
8416    document.addEventListener("mouseup", onUp);
8417  }
8418  adjust(delta) {
8419    this.valueChange.emit(Math.max(0, Math.min(this.max(), this.value() + delta)));
8420  }
8421  static \u0275fac = function AudioSliderComponent_Factory(__ngFactoryType__) {
8422    return new (__ngFactoryType__ || _AudioSliderComponent)();
8423  };
8424  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _AudioSliderComponent, selectors: [["app-audio-slider"]], inputs: { value: [1, "value"], icon: [1, "icon"], label: [1, "label"], max: [1, "max"] }, outputs: { valueChange: "valueChange" }, decls: 9, vars: 14, consts: [[1, "flex", "flex-col", "gap-3"], [1, "flex", "items-center", "gap-2"], ["styleClass", "text-grey-500", 3, "name", "size"], [1, "text-sm", "font-medium"], ["role", "slider", "tabindex", "0", 1, "relative", "h-10", "w-full", "rounded-base", "bg-grey-50", "cursor-pointer", "select-none", 3, "click", "keydown.arrowRight", "keydown.arrowLeft"], [1, "absolute", "inset-y-0", "left-0", "rounded-l-base", "bg-secondary-500"], [1, "absolute", "h-[120%]", "-top-1", "w-3", "rounded-full", "bg-white", "shadow-md", "border", "border-grey-50", 3, "mousedown"]], template: function AudioSliderComponent_Template(rf, ctx) {
8425    if (rf & 1) {
8426      \u0275\u0275elementStart(0, "div", 0)(1, "div", 1);
8427      \u0275\u0275element(2, "ui-icon", 2);
8428      \u0275\u0275elementStart(3, "span", 3);
8429      \u0275\u0275text(4);
8430      \u0275\u0275pipe(5, "translate");
8431      \u0275\u0275elementEnd()();
8432      \u0275\u0275elementStart(6, "div", 4);
8433      \u0275\u0275listener("click", function AudioSliderComponent_Template_div_click_6_listener($event) {
8434        return ctx.onSliderClick($event);
8435      })("keydown.arrowRight", function AudioSliderComponent_Template_div_keydown_arrowRight_6_listener() {
8436        return ctx.adjust(1);
8437      })("keydown.arrowLeft", function AudioSliderComponent_Template_div_keydown_arrowLeft_6_listener() {
8438        return ctx.adjust(-1);
8439      });
8440      \u0275\u0275element(7, "div", 5);
8441      \u0275\u0275elementStart(8, "div", 6);
8442      \u0275\u0275listener("mousedown", function AudioSliderComponent_Template_div_mousedown_8_listener($event) {
8443        return ctx.onThumbDrag($event);
8444      });
8445      \u0275\u0275elementEnd()()();
8446    }
8447    if (rf & 2) {
8448      \u0275\u0275advance(2);
8449      \u0275\u0275property("name", ctx.icon())("size", 16);
8450      \u0275\u0275advance(2);
8451      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(5, 12, ctx.label()));
8452      \u0275\u0275advance(2);
8453      \u0275\u0275attribute("aria-valuenow", ctx.value())("aria-valuemin", 0)("aria-valuemax", ctx.max());
8454      \u0275\u0275advance();
8455      \u0275\u0275styleProp("width", ctx.value(), "%");
8456      \u0275\u0275advance();
8457      \u0275\u0275styleProp("left", ctx.value(), "%")("margin-left", -6, "px");
8458    }
8459  }, dependencies: [TranslatePipe, IconComponent], encapsulation: 2 });
8460};
8461(() => {
8462  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(AudioSliderComponent, [{
8463    type: Component,
8464    args: [{ selector: "app-audio-slider", imports: [TranslatePipe, IconComponent], template: '<div class="flex flex-col gap-3">\n  <div class="flex items-center gap-2">\n    <ui-icon [name]="icon()" [size]="16" styleClass="text-grey-500" />\n    <span class="text-sm font-medium">{{ label() | translate }}</span>\n  </div>\n  <div\n    (click)="onSliderClick($event)"\n    (keydown.arrowRight)="adjust(1)"\n    (keydown.arrowLeft)="adjust(-1)"\n    role="slider"\n    tabindex="0"\n    [attr.aria-valuenow]="value(
8464)"\n    [attr.aria-valuemin]="0"\n    [attr.aria-valuemax]="max()"\n    class="relative h-10 w-full rounded-base bg-grey-50 cursor-pointer select-none"\n  >\n    <div class="absolute inset-y-0 left-0 rounded-l-base bg-secondary-500" [style.width.%]="value()"></div>\n    <div\n      (mousedown)="onThumbDrag($event)"\n      class="absolute h-[120%] -top-1 w-3 rounded-full bg-white shadow-md border border-grey-50"\n      [style.left.%]="value()"\n      [style.margin-left.px]="-6"\n    ></div>\n  </div>\n</div>\n' }]
8465  }], null, null);
8466})();
8467(() => {
8468  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(AudioSliderComponent, { className: "AudioSliderComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/instagram/components/audio/components/audio-dialog/components/audio-edit/components/audio-slider/audio-slider.component.ts", lineNumber: 10 });
8469})();
8470
8471// libs/socialgest/messenger/src/presenter/components/extras/instagram/components/audio/components/audio-dialog/components/audio-edit/components/audio-loop-toggle/audio-loop-toggle.component.ts
8472var AudioLoopToggleComponent = class _AudioLoopToggleComponent {
8473  value = input.required();
8474  valueChange = output();
8475  static \u0275fac = function AudioLoopToggleComponent_Factory(__ngFactoryType__) {
8476    return new (__ngFactoryType__ || _AudioLoopToggleComponent)();
8477  };
8478  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _AudioLoopToggleComponent, selectors: [["app-audio-loop-toggle"]], inputs: { value: [1, "value"] }, outputs: { valueChange: "valueChange" }, decls: 7, vars: 5, consts: [[1, "flex", "items-center", "justify-between", "gap-3", "p-2"], [1, "flex", "items-center", "gap-2"], ["name", "repeat", "styleClass", "text-grey-500", 3, "size"], [1, "text-sm", "font-medium"], [3, "ngModelChange", "ngModel"]], template: function AudioLoopToggleComponent_Template(rf, ctx) {
8479    if (rf & 1) {
8480      \u0275\u0275elementStart(0, "div", 0)(1, "div", 1);
8481      \u0275\u0275element(2, "ui-icon", 2);
8482      \u0275\u0275elementStart(3, "span", 3);
8483      \u0275\u0275text(4);
8484      \u0275\u0275pipe(5, "translate");
8485      \u0275\u0275elementEnd()();
8486      \u0275\u0275elementStart(6, "ui-toggle", 4);
8487      \u0275\u0275listener("ngModelChange", function AudioLoopToggleComponent_Template_ui_toggle_ngModelChange_6_listener($event) {
8488        return ctx.valueChange.emit($event);
8489      });
8490      \u0275\u0275elementEnd()();
8491    }
8492    if (rf & 2) {
8493      \u0275\u0275advance(2);
8494      \u0275\u0275property("size", 16);
8495      \u0275\u0275advance(2);
8496      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(5, 3, "MESSENGER.INSTAGRAM.AUDIO_LOOP"));
8497      \u0275\u0275advance(2);
8498      \u0275\u0275property("ngModel", ctx.value());
8499    }
8500  }, dependencies: [FormsModule, NgControlStatus, NgModel, TranslatePipe, IconComponent, ToggleComponent], encapsulation: 2 });
8501};
8502(() => {
8503  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(AudioLoopToggleComponent, [{
8504    type: Component,
8505    args: [{ selector: "app-audio-loop-toggle", imports: [FormsModule, TranslatePipe, IconComponent, ToggleComponent], template: `<div class="flex items-center justify-between gap-3 p-2">
8506  <div class="flex items-center gap-2">
8507    <ui-icon name="repeat" [size]="16" styleClass="text-grey-500" />
8508    <span class="text-sm font-medium">{{ 'MESSENGER.INSTAGRAM.AUDIO_LOOP' | translate }}</span>
8509  </div>
8510  <ui-toggle [ngModel]="value()" (ngModelChange)="valueChange.emit($event)" />
8511</div>
8512` }]
8513  }], null, null);
8514})();
8515(() => {
8516  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(AudioLoopToggleComponent, { className: "AudioLoopToggleComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/instagram/components/audio/components/audio-dialog/components/audio-edit/components/audio-loop-toggle/audio-loop-toggle.component.ts", lineNumber: 11 });
8517})();
8518
8519// libs/socialgest/messenger/src/presenter/components/extras/instagram/components/audio/components/audio-dialog/components/audio-edit/audio-edit.component.ts
8520function AudioEditComponent_Conditional_8_Template(rf, ctx) {
8521  if (rf & 1) {
8522    \u0275\u0275elementStart(0, "p", 5);
8523    \u0275\u0275text(1);
8524    \u0275\u0275pipe(2, "translate");
8525    \u0275\u0275elementEnd();
8526  }
8527  if (rf & 2) {
8528    \u0275\u0275advance();
8529    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(2, 1, "MESSENGER.INSTAGRAM.AUDIO_ORIGINAL_VOLUME_ZERO_WARNING"), " ");
8530  }
8531}
8532var AudioEditComponent = class _AudioEditComponent {
8533  audio = input.required();
8534  track = input.required();
8535  cancel = output();
8536  apply = output();
8537  volume = signal(100);
8538  originalVolume = signal(100);
8539  shouldLoop = signal(false);
8540  constructor() {
8541    effect(() => {
8542      const audio = this.audio();
8543      this.volume.set(audio.volume);
8544      this.originalVolume.set(audio.originalVolume);
8545      this.shouldLoop.set(audio.shouldLoop);
8546    });
8547  }
8548  emitApply() {
8549    this.apply.emit({
8550      id: this.track().id,
8551      volume: this.volume(),
8552      originalVolume: this.originalVolume(),
8553      shouldLoop: this.shouldLoop(),
8554      track: {
8555        id: this.track().id,
8556        title: this.track().title,
8557        artist: this.track().artist,
8558        thumbnail: this.track().thumbnail,
8559        previewUrl: this.track().previewUrl,
8560        duration: this.track().duration
8561      }
8562    });
8563  }
8564  static \u0275fac = function AudioEditComponent_Factory(__ngFactoryType__) {
8565    return new (__ngFactoryType__ || _AudioEditComponent)();
8566  };
8567  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _AudioEditComponent, selectors: [["app-audio-edit"]], inputs: { audio: [1, "audio"], track: [1, "track"] }, outputs: { cancel: "cancel", apply: "apply" }, decls: 15, vars: 12, consts: [[1, "w-[28rem]", "h-[33rem]", "flex", "flex-col", "gap-4", "p-5"], [1, "text-base", "font-semibold"], [1, "flex-1", "flex", "flex-col", "gap-6"], [1, "flex", "flex-col", "gap-2"], ["icon", "mic", "label", "MESSENGER.INSTAGRAM.AUDIO_ORIGINAL_SOUND", 3, "valueChange", "value"], [1, "text-red-500", "text-xs"], ["icon", "music", "label", "MESSENGER.INSTAGRAM.AUDIO_SOUND", 3, "valueChange", "value"], [1, "flex", "items-center", "justify-end", "gap-5", "pb-1"], ["severity", "contrast", 1, "w-full", 3, "click", "label"], [1, "w-full", 3, "click", "label"]], template: function AudioEditComponent_Template(rf, ctx) {
8568    if (rf & 1) {
8569      \u0275\u0275elementStart(0, "article", 0)(1, "header")(2, "h2", 1);
8570      \u0275\u0275text(3);
8571      \u0275\u0275pipe(4, "translate");
8572      \u0275\u0275elementEnd()();
8573      \u0275\u0275elementStart(5, "div", 2)(6, "div", 3)(7, "app-audio-slider", 4);
8574      \u0275\u0275listener("valueChange", function AudioEditComponent_Template_app_audio_slider_valueChange_7_listener($event) {
8575        return ctx.originalVolume.set($event);
8576      });
8577      \u0275\u0275elementEnd();
8578      \u0275\u0275conditionalCreate(8, AudioEditComponent_Conditional_8_Template, 3, 3, "p", 5);
8579      \u0275\u0275elementEnd();
8580      \u0275\u0275elementStart(9, "app-audio-slider", 6);
8581      \u0275\u0275listener("valueChange", function AudioEditComponent_Template_app_audio_slider_valueChange_9_listener($event) {
8582        return ctx.volume.set($event);
8583      });
8584      \u0275\u0275elementEnd()();
8585      \u0275\u0275elementStart(10, "footer", 7)(11, "ui-button", 8);
8586      \u0275\u0275pipe(12, "translate");
8587      \u0275\u0275listener("click", function AudioEditComponent_Template_ui_button_click_11_listener() {
8588        return ctx.cancel.emit();
8589      });
8590      \u0275\u0275elementEnd();
8591      \u0275\u0275elementStart(13, "ui-button", 9);
8592      \u0275\u0275pipe(14, "translate");
8593      \u0275\u0275listener("click", function AudioEditComponent_Template_ui_button_click_13_listener() {
8594        return ctx.emitApply();
8595      });
8596      \u0275\u0275elementEnd()()();
8597    }
8598    if (rf & 2) {
8599      \u0275\u0275advance(3);
8600      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 6, "MESSENGER.INSTAGRAM.AUDIO_EDIT"));
8601      \u0275\u0275advance(4);
8602      \u0275\u0275property("value", ctx.originalVolume());
8603      \u0275\u0275advance();
8604      \u0275\u0275conditional(ctx.originalVolume() === 0 ? 8 : -1);
8605      \u0275\u0275advance();
8606      \u0275\u0275property("value", ctx.volume());
8607      \u0275\u0275advance(2);
8608      \u0275\u0275property("label", \u0275\u0275pipeBind1(12, 8, "GLOBAL.CANCEL"));
8609      \u0275\u0275advance(2);
8610      \u0275\u0275property("label", \u0275\u0275pipeBind1(14, 10, "GLOBAL.APPLY"));
8611    }
8612  }, dependencies: [TranslatePipe, ButtonComponent, AudioSliderComponent], encapsulation: 2 });
8613};
8614(() => {
8615  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(AudioEditComponent, [{
8616    type: Component,
8617    args: [{ selector: "app-audio-edit", imports: [TranslatePipe, ButtonComponent, AudioSliderComponent, AudioLoopToggleComponent], template: `<article class="w-[28rem] h-[33rem] flex flex-col gap-4 p-5">
8618  <header>
8619    <h2 class="text-base font-semibold">{{ 'MESSENGER.INSTAGRAM.AUDIO_EDIT' | translate }}</h2>
8620  </header>
8621
8622  <div class="flex-1 flex flex-col gap-6">
8623    <div class="flex flex-col gap-2">
8624      <app-audio-slider
8625        (valueChange)="originalVolume.set($event)"
8626        [value]="originalVolume()"
8627        icon="mic"
8628        label="MESSENGER.INSTAGRAM.AUDIO_ORIGINAL_SOUND"
8629      />
8630      @if (originalVolume() === 0) {
8631      <p class="text-red-500 text-xs">
8632        {{ 'MESSENGER.INSTAGRAM.AUDIO_ORIGINAL_VOLUME_ZERO_WARNING' | translate }}
8633      </p>
8634      }
8635    </div>
8636
8637    <app-audio-slider
8638      (valueChange)="volume.set($event)"
8639      [value]="volume()"
8640      icon="music"
8641      label="MESSENGER.INSTAGRAM.AUDIO_SOUND"
8642    />
8643
8644    <!--
8645      Meta's IG Reels Graph API does not honor \`should_loop_audio\` for Business
8646      accounts \u2014 verified empirically with curl A/B tests across both transports
8647      (JSON object body + form-encoded JSON-string) on 2026-05-22. The field is
8648      sent correctly all the way to graph.facebook.com but is silently ignored.
8649      Hiding the toggle until Meta supports it. The shouldLoop signal + domain
8650      model + mapper are kept intact so re-enabling is just uncommenting this.
8651    <hr class="border-grey-50" />
8652    <app-audio-loop-toggle (valueChange)="shouldLoop.set($event)" [value]="shouldLoop()" />
8653    -->
8654  </div>
8655
8656  <footer class="flex items-center justify-end gap-5 pb-1">
8657    <ui-button (click)="cancel.emit()" [label]="'GLOBAL.CANCEL' | translate" severity="contrast" class="w-full" />
8658    <ui-button (click)="emitApply()" [label]="'GLOBAL.APPLY' | translate" class="w-full" />
8659  </footer>
8660</article>
8661` }]
8662  }], () => [], null);
8663})();
8664(() => {
8665  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(AudioEditComponent, { className: "AudioEditComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/instagram/components/audio/components/audio-dialog/components/audio-edit/audio-edit.component.ts", lineNumber: 12 });
8666})();
8667
8668// libs/socialgest/messenger/src/presenter/components/extras/instagram/components/audio/components/audio-dialog/components/audio-filter/audio-filter.component.ts
8669function AudioFilterComponent_ng_template_12_Template(rf, ctx) {
8670  if (rf & 1) {
8671    \u0275\u0275elementStart(0, "span");
8672    \u0275\u0275text(1);
8673    \u0275\u0275pipe(2, "translate");
8674    \u0275\u0275elementEnd();
8675  }
8676  if (rf & 2) {
8677    const item_r1 = ctx.$implicit;
8678    \u0275\u0275advance();
8679    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(2, 1, item_r1.label));
8680  }
8681}
8682function AudioFilterComponent_ng_template_13_Template(rf, ctx) {
8683  if (rf & 1) {
8684    \u0275\u0275elementStart(0, "span");
8685    \u0275\u0275text(1);
8686    \u0275\u0275pipe(2, "translate");
8687    \u0275\u0275elementEnd();
8688  }
8689  if (rf & 2) {
8690    const item_r2 = ctx.$implicit;
8691    \u0275\u0275advance();
8692    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(2, 1, item_r2.label));
8693  }
8694}
8695var AudioFilterComponent = class _AudioFilterComponent {
8696  audioType = input("music");
8697  cancel = output();
8698  apply = output();
8699  selectedAudioType = "music";
8700  audioTypes = [
8701    { label: "MESSENGER.INSTAGRAM.AUDIO_TYPE_MUSIC", value: "music" },
8702    { label: "MESSENGER.INSTAGRAM.AUDIO_TYPE_ORIGINAL_SOUND", value: "original_sound" }
8703  ];
8704  constructor() {
8705    effect(() => {
8706      this.selectedAudioType = this.audioType();
8707    });
8708  }
8709  static \u0275fac = function AudioFilterComponent_Factory(__ngFactoryType__) {
8710    return new (__ngFactoryType__ || _AudioFilterComponent)();
8711  };
8712  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _AudioFilterComponent, selectors: [["app-audio-filter"]], inputs: { audioType: [1, "audioType"] }, outputs: { cancel: "cancel", apply: "apply" }, decls: 17, vars: 11, consts: [[1, "w-[28rem]", "h-[33rem]", "flex", "flex-col", "gap-4", "p-5"], [1, "flex", "items-center", "justify-between"], [1, "text-base", "font-semibold"], [1, "flex-1", "flex", "flex-col", "gap-5"], [1, "flex", "flex-col"], [1, "label"], ["optionLabel", "label", "optionValue", "value", 3, "ngModelChange", "ngModel", "options", "placeholder"], ["selectSelectedItem", ""], ["selectItem", ""], [1, "flex", "items-center", "gap-5", "pb-1"], ["label", "GLOBAL.CANCEL", "severity", "contrast", 1, "w-full", 3, "click"], ["label", "GLOBAL.APPLY", 1, "w-full", 3, "click"]], template: function AudioFilterComponent_Template(rf, ctx) {
8713    if (rf & 1) {
8714      \u0275\u0275elementStart(0, "article", 0)(1, "header", 1)(2, "h2", 2);
8715      \u0275\u0275text(3);
8716      \u0275\u0275pipe(4, "translate");
8717      \u0275\u0275elementEnd()();
8718      \u0275\u0275elementStart(5, "div", 3)(6, "div", 4)(7, "span", 5);
8719      \u0275\u0275text(8);
8720      \u0275\u0275pipe(9, "translate");
8721      \u0275\u0275elementEnd();
8722      \u0275\u0275elementStart(10, "ui-select", 6);
8723      \u0275\u0275pipe(11, "translate");
8724      \u0275\u0275twoWayListener("ngModelChange", function AudioFilterComponent_Template_ui_select_ngModelChange_10_listener($event) {
8725        \u0275\u0275twoWayBindingSet(ctx.selectedAudioType, $event) || (ctx.selectedAudioType = $event);
8726        return $event;
8727      });
8728      \u0275\u0275template(12, AudioFilterComponent_ng_template_12_Template, 3, 3, "ng-template", 7)(13, AudioFilterComponent_ng_template_13_Template, 3, 3, "ng-template", 8);
8729      \u0275\u0275elementEnd()()();
8730      \u0275\u0275elementStart(14, "footer", 9)(15, "ui-button", 10);
8731      \u0275\u0275listener("click", function AudioFilterComponent_Template_ui_button_click_15_listener() {
8732        return ctx.cancel.emit();
8733      });
8734      \u0275\u0275elementEnd();
8735      \u0275\u0275elementStart(16, "ui-button", 11);
8736      \u0275\u0275listener("click", function AudioFilterComponent_Template_ui_button_click_16_listener() {
8737        return ctx.apply.emit({ audioType: ctx.selectedAudioType });
8738      });
8739      \u0275\u0275elementEnd()()();
8740    }
8741    if (rf & 2) {
8742      \u0275\u0275advance(3);
8743      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 5, "MESSENGER.INSTAGRAM.AUDIO_FILTER"));
8744      \u0275\u0275advance(5);
8745      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(9, 7, "MESSENGER.INSTAGRAM.AUDIO_BY_TYPE"));
8746      \u0275\u0275advance(2);
8747      \u0275\u0275twoWayProperty("ngModel", ctx.selectedAudioType);
8748      \u0275\u0275property("options", ctx.audioTypes)("placeholder", \u0275\u0275pipeBind1(11, 9, "GLOBAL.SELECT"));
8749    }
8750  }, dependencies: [
8751    FormsModule,
8752    NgControlStatus,
8753    NgModel,
8754    TranslatePipe,
8755    ButtonComponent,
8756    SelectComponent,
8757    SelectSelectedItemDirective,
8758    SelectItemDirective
8759  ], encapsulation: 2 });
8760};
8761(() => {
8762  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(AudioFilterComponent, [{
8763    type: Component,
8764    args: [{ selector: "app-audio-filter", imports: [
8765      FormsModule,
8766      TranslatePipe,
8767      ButtonComponent,
8768      SelectComponent,
8769      SelectSelectedItemDirective,
8770      SelectItemDirective
8771    ], template: `<article class="w-[28rem] h-[33rem] flex flex-col gap-4 p-5">
8772  <header class="flex items-center justify-between">
8773    <h2 class="text-base font-semibold">{{ 'MESSENGER.INSTAGRAM.AUDIO_FILTER' | translate }}</h2>
8774  </header>
8775
8776  <div class="flex-1 flex flex-col gap-5">
8777    <div class="flex flex-col">
8778      <span class="label">{{ 'MESSENGER.INSTAGRAM.AUDIO_BY_TYPE' | translate }}</span>
8779      <ui-select
8780        [(ngModel)]="selectedAudioType"
8781        [options]="audioTypes"
8782        [placeholder]="'GLOBAL.SELECT' | translate"
8783        optionLabel="label"
8784        optionValue="value"
8785      >
8786        <ng-template selectSelectedItem let-item>
8787          <span>{{ item.label | translate }}</span>
8788        </ng-template>
8789        <ng-template selectItem let-item>
8790          <span>{{ item.label | translate }}</span>
8791        </ng-template>
8792      </ui-select>
8793    </div>
8794  </div>
8795
8796  <footer class="flex items-center gap-5 pb-1">
8797    <ui-button (click)="cancel.emit()" label="GLOBAL.CANCEL" severity="contrast" class="w-full" />
8798    <ui-button (click)="apply.emit({ audioType: selectedAudioType })" label="GLOBAL.APPLY" class="w-full" />
8799  </footer>
8800</article>
8801` }]
8802  }], () => [], null);
8803})();
8804(() => {
8805  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(AudioFilterComponent, { className: "AudioFilterComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/instagram/components/audio/components/audio-dialog/components/audio-filter/audio-filter.component.ts", lineNumber: 21 });
8806})();
8807
8808// libs/socialgest/messenger/src/presenter/components/extras/instagram/components/audio/components/audio-dialog/audio-dialog.component.ts
8809function AudioDialogComponent_Conditional_1_Template(rf, ctx) {
8810  if (rf & 1) {
8811    const _r1 = \u0275\u0275getCurrentView();
8812    \u0275\u0275elementStart(0, "app-audio-filter", 3);
8813    \u0275\u0275listener("apply", function AudioDialogComponent_Conditional_1_Template_app_audio_filter_apply_0_listener($event) {
8814      \u0275\u0275restoreView(_r1);
8815      const ctx_r1 = \u0275\u0275nextContext();
8816      ctx_r1.filterAudioType.set($event.audioType);
8817      return \u0275\u0275resetView(ctx_r1.view.set("search"));
8818    })("cancel", function AudioDialogComponent_Conditional_1_Template_app_audio_filter_cancel_0_listener() {
8819      \u0275\u0275restoreView(_r1);
8820      const ctx_r1 = \u0275\u0275nextContext();
8821      return \u0275\u0275resetView(ctx_r1.view.set("search"));
8822    });
8823    \u0275\u0275elementEnd();
8824  }
8825  if (rf & 2) {
8826    const ctx_r1 = \u0275\u0275nextContext();
8827    \u0275\u0275property("audioType", ctx_r1.filterAudioType());
8828  }
8829}
8830function AudioDialogComponent_Conditional_2_Template(rf, ctx) {
8831  if (rf & 1) {
8832    const _r3 = \u0275\u0275getCurrentView();
8833    \u0275\u0275elementStart(0, "app-audio-edit", 4);
8834    \u0275\u0275listener("apply", function AudioDialogComponent_Conditional_2_Template_app_audio_edit_apply_0_listener($event) {
8835      \u0275\u0275restoreView(_r3);
8836      const ctx_r1 = \u0275\u0275nextContext();
8837      ctx_r1.applyAudioEdit($event);
8838      return \u0275\u0275resetView(ctx_r1.view.set("search"));
8839    })("cancel", function AudioDialogComponent_Conditional_2_Template_app_audio_edit_cancel_0_listener() {
8840      \u0275\u0275restoreView(_r3);
8841      const ctx_r1 = \u0275\u0275nextContext();
8842      return \u0275\u0275resetView(ctx_r1.view.set("search"));
8843    });
8844    \u0275\u0275elementEnd();
8845  }
8846  if (rf & 2) {
8847    const ctx_r1 = \u0275\u0275nextContext();
8848    \u0275\u0275property("audio", ctx_r1.store.post().options.instagram.audio)("track", ctx_r1.selectedTrack());
8849  }
8850}
8851var AudioDialogComponent = class _AudioDialogComponent {
8852  userList = input.required();
8853  store = inject(MessengerStore);
8854  view = signal("search");
8855  selectedTrack = signal(null);
8856  filterAudioType = signal("music");
8857  ngOnInit() {
8858    const track = this.store.post().options.instagram.audio.track;
8859    if (track) {
8860      this.selectedTrack.set(AudioTrack.from(track));
8861    }
8862  }
8863  selectTrack(track) {
8864    this.selectedTrack.set(track);
8865    this.store.post().options.instagram.upsert.audio(track ? {
8866      id: track.id,
8867      track: {
8868        id: track.id,
8869        title: track.title,
8870        artist: track.artist,
8871        thumbnail: track.thumbnail,
8872        previewUrl: track.previewUrl,
8873        duration: track.duration
8874      }
8875    } : IgAudio.empty().toPrimitives());
8876  }
8877  applyAudioEdit(payload) {
8878    this.store.post().options.instagram.upsert.audio(payload);
8879  }
8880  static \u0275fac = function AudioDialogComponent_Factory(__ngFactoryType__) {
8881    return new (__ngFactoryType__ || _AudioDialogComponent)();
8882  };
8883  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _AudioDialogComponent, selectors: [["app-audio-dialog"]], inputs: { userList: [1, "userList"] }, decls: 3, vars: 6, consts: [[3, "trackSelected", "goToFilter", "goToEdit", "hidden", "userList", "selectedTrack", "filterAudioType"], [3, "audioType"], [3, "audio", "track"], [3, "apply", "cancel", "audioType"], [3, "apply", "cancel", "audio", "track"]], template: function AudioDialogComponent_Template(rf, ctx) {
8884    if (rf & 1) {
8885      \u0275\u0275elementStart(0, "app-audio-search", 0);
8886      \u0275\u0275listener("trackSelected", function AudioDialogComponent_Template_app_audio_search_trackSelected_0_listener($event) {
8887        return ctx.selectTrack($event);
8888      })("goToFilter", function AudioDialogComponent_Template_app_audio_search_goToFilter_0_listener() {
8889        return ctx.view.set("filter");
8890      })("goToEdit", function AudioDialogComponent_Template_app_audio_search_goToEdit_0_listener() {
8891        return ctx.view.set("edit");
8892      });
8893      \u0275\u0275elementEnd();
8894      \u0275\u0275conditionalCreate(1, AudioDialogComponent_Conditional_1_Template, 1, 1, "app-audio-filter", 1);
8895      \u0275\u0275conditionalCreate(2, AudioDialogComponent_Conditional_2_Template, 1, 2, "app-audio-edit", 2);
8896    }
8897    if (rf & 2) {
8898      \u0275\u0275property("hidden", ctx.view() !== "search")("userList", ctx.userList())("selectedTrack", ctx.selectedTrack())("filterAudioType", ctx.filterAudioType());
8899      \u0275\u0275advance();
8900      \u0275\u0275conditional(ctx.view() === "filter" ? 1 : -1);
8901      \u0275\u0275advance();
8902      \u0275\u0275conditional(ctx.view() === "edit" ? 2 : -1);
8903    }
8904  }, dependencies: [AudioSearchComponent, AudioEditComponent, AudioFilterComponent], encapsulation: 2 });
8905};
8906(() => {
8907  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(AudioDialogComponent, [{
8908    type: Component,
8909    args: [{ selector: "app-audio-dialog", imports: [AudioSearchComponent, AudioEditComponent, AudioFilterComponent], template: `<app-audio-search
8910  (trackSelected)="selectTrack($event)"
8911  (goToFilter)="view.set('filter')"
8912  (goToEdit)="view.set('edit')"
8913  [hidden]="view() !== 'search'"
8914  [userList]="userList()"
8915  [selectedTrack]="selectedTrack()"
8916  [filterAudioType]="filterAudioType()"
8917/>
8918@if (view() === 'filter') {
8919<app-audio-filter
8920  (apply)="filterAudioType.set($event.audioType); view.set('search')"
8921  (cancel)="view.set('search')"
8922  [audioType]="filterAudioType()"
8923/>
8924} @if (view() === 'edit') {
8925<app-audio-edit
8926  (apply)="applyAudioEdit($event); view.set('search')"
8927  (cancel)="view.set('search')"
8928  [audio]="store.post().options.instagram.audio"
8929  [track]="selectedTrack()!"
8930/>
8931}
8932` }]
8933  }], null, null);
8934})();
8935(() => {
8936  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(AudioDialogComponent, { className: "AudioDialogComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/instagram/components/audio/components/audio-dialog/audio-dialog.component.ts", lineNumber: 15 });
8937})();
8938
8939// libs/socialgest/messenger/src/presenter/components/extras/instagram/components/audio/audio.component.ts
8940function AudioComponent_Conditional_4_Template(rf, ctx) {
8941  if (rf & 1) {
8942    \u0275\u0275element(0, "app-audio-dialog", 3);
8943  }
8944  if (rf & 2) {
8945    const ctx_r2 = \u0275\u0275nextContext();
8946    \u0275\u0275property("userList", ctx_r2.userList());
8947  }
8948}
8949var AudioComponent = class _AudioComponent {
8950  userList = input.required();
8951  store = inject(MessengerStore);
8952  static \u0275fac = function AudioComponent_Factory(__ngFactoryType__) {
8953    return new (__ngFactoryType__ || _AudioComponent)();
8954  };
8955  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _AudioComponent, selectors: [["app-audio"]], inputs: { userList: [1, "userList"] }, decls: 5, vars: 12, consts: [["popover", ""], ["icon", "music", "iconStyleClass", "size-1!", 3, "click", "disabled", "variant", "severity", "tooltip", "tooltipPosition", "positionTop", "styleClass"], ["styleClass", "no-gutter -mt-2!"], [3, "userList"]], template: function AudioComponent_Template(rf, ctx) {
8956    if (rf & 1) {
8957      const _r1 = \u0275\u0275getCurrentView();
8958      \u0275\u0275elementStart(0, "ui-button", 1);
8959      \u0275\u0275pipe(1, "translate");
8960      \u0275\u0275listener("click", function AudioComponent_Template_ui_button_click_0_listener($event) {
8961        \u0275\u0275restoreView(_r1);
8962        const popover_r2 = \u0275\u0275reference(3);
8963        return \u0275\u0275resetView(popover_r2.toggle($event));
8964      });
8965      \u0275\u0275elementEnd();
8966      \u0275\u0275elementStart(2, "ui-popover", 2, 0);
8967      \u0275\u0275conditionalCreate(4, AudioComponent_Conditional_4_Template, 1, 1, "app-audio-dialog", 3);
8968      \u0275\u0275elementEnd();
8969    }
8970    if (rf & 2) {
8971      const popover_r2 = \u0275\u0275reference(3);
8972      const post_r4 = ctx.store.post();
8973      const hasAudio_r5 = post_r4.options.instagram.has.audio;
8974      const isInstagramByFacebook_r6 = post_r4.userList.hasOnlyInstagramByFacebook;
8975      const isStory_r7 = post_r4.is.instagram.story;
8976      const isAllVideo_r8 = post_r4.multimediaList.videos.has.items && post_r4.multimediaList.has.all.video;
8977      const isEnabled_r9 = isInstagramByFacebook_r6 && !isStory_r7 && isAllVideo_r8;
8978      const tooltipKey_r10 = !isInstagramByFacebook_r6 ? "MESSENGER.INSTAGRAM.AUDIO_DISABLED_INSTAGRAM_BY_FACEBOOK" : isStory_r7 ? "MESSENGER.INSTAGRAM.AUDIO_DISABLED_STORY" : !isAllVideo_r8 ? "MESSENGER.INSTAGRAM.AUDIO_DISABLED_VIDEO_ONLY" : "MESSENGER.INSTAGRAM.AUDIO";
8979      \u0275\u0275property("styleClass", \u0275\u0275interpolate2("cursor-pointer\n    ", popover_r2.isOpen() && "bg-grey-50!", "\n    ", hasAudio_r5 && "bg-secondary-50!"))("disabled", !isEnabled_r9)("variant", hasAudio_r5 ? "outlined" : void 0)("severity", hasAudio_r5 ? "secondary" : "contrast")("tooltip", \u0275\u0275pipeBind1(1, 10, tooltipKey_r10))("tooltipPosition", "top")("positionTop", -10);
8980      \u0275\u0275advance(4);
8981      \u0275\u0275conditional(popover_r2.isOpen() ? 4 : -1);
8982    }
8983  }, dependencies: [TranslatePipe, ButtonComponent, TooltipDirective, PopoverComponent, AudioDialogComponent], encapsulation: 2 });
8984};
8985(() => {
8986  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(AudioComponent, [{
8987    type: Component,
8988    args: [{ selector: "app-audio", imports: [TranslatePipe, ButtonComponent, TooltipDirective, PopoverComponent, AudioDialogComponent], template: `@let post = store.post(); @let hasAudio = post.options.instagram.has.audio;
8988 @let isInstagramByFacebook =
8989post.userList.hasOnlyInstagramByFacebook; @let isStory = post.is.instagram.story; @let isAllVideo =
8990post.multimediaList.videos.has.items && post.multimediaList.has.all.video; @let isEnabled = isInstagramByFacebook &&
8991!isStory && isAllVideo; @let tooltipKey = !isInstagramByFacebook ?
8992'MESSENGER.INSTAGRAM.AUDIO_DISABLED_INSTAGRAM_BY_FACEBOOK' : isStory ? 'MESSENGER.INSTAGRAM.AUDIO_DISABLED_STORY' :
8993!isAllVideo ? 'MESSENGER.INSTAGRAM.AUDIO_DISABLED_VIDEO_ONLY' : 'MESSENGER.INSTAGRAM.AUDIO';
8994
8995<ui-button
8996  (click)="popover.toggle($event)"
8997  icon="music"
8998  [disabled]="!isEnabled"
8999  [variant]="hasAudio ? 'outlined' : undefined"
9000  [severity]="hasAudio ? 'secondary' : 'contrast'"
9001  [tooltip]="tooltipKey | translate"
9002  [tooltipPosition]="'top'"
9003  [positionTop]="-10"
9004  styleClass="cursor-pointer
9005    {{ popover.isOpen() && 'bg-grey-50!' }}
9006    {{ hasAudio && 'bg-secondary-50!' }}"
9007  iconStyleClass="size-1!"
9008/>
9009
9010<ui-popover #popover styleClass="no-gutter -mt-2!">
9011  @if (popover.isOpen()) {
9012  <app-audio-dialog [userList]="userList()" />
9013  }
9014</ui-popover>
9015` }]
9016  }], null, null);
9017})();
9018(() => {
9019  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(AudioComponent, { className: "AudioComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/instagram/components/audio/audio.component.ts", lineNumber: 12 });
9020})();
9021
9022// libs/socialgest/messenger/src/presenter/components/extras/instagram/instagram.component.ts
9023var InstagramComponent = class _InstagramComponent {
9024  store = inject(MessengerStore);
9025  userStore = inject(UserStore);
9026  static \u0275fac = function InstagramComponent_Factory(__ngFactoryType__) {
9027    return new (__ngFactoryType__ || _InstagramComponent)();
9028  };
9029  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _InstagramComponent, selectors: [["app-instagram"]], decls: 14, vars: 12, consts: [[1, "flex", "gap-12"], [3, "platform"], [1, "flex", "flex-col", "gap-2.5"], [1, "text-sm", "font-semibold"], [1, "flex", "gap-4"], [3, "userList", "userType"], [3, "userList"], [3, "userType"]], template: function InstagramComponent_Template(rf, ctx) {
9030    if (rf & 1) {
9031      \u0275\u0275elementStart(0, "section", 0);
9032      \u0275\u0275element(1, "app-publication-type", 1);
9033      \u0275\u0275elementStart(2, "div", 2)(3, "h3", 3);
9034      \u0275\u0275text(4);
9035      \u0275\u0275pipe(5, "translate");
9036      \u0275\u0275elementEnd();
9037      \u0275\u0275elementStart(6, "div", 4);
9038      \u0275\u0275element(7, "app-location", 5)(8, "app-first-comment", 5)(9, "app-collaborators", 6)(10, "app-tags", 6)(11, "app-mention", 7)(12, "app-audio", 6)(13, "app-url-shortener");
9039      \u0275\u0275elementEnd()()();
9040    }
9041    if (rf & 2) {
9042      \u0275\u0275advance();
9043      \u0275\u0275property("platform", "instagram");
9044      \u0275\u0275advance(3);
9045      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(5, 10, "MESSENGER.EXTRAS"));
9046      const userList_r1 = ctx.store.post().userList.instagram;
9047      \u0275\u0275advance(3);
9048      \u0275\u0275property("userList", ctx.userStore.userList().ok.instagramByF
9048acebook)("userType", userList_r1.first.type);
9049      \u0275\u0275advance();
9050      \u0275\u0275property("userList", userList_r1)("userType", userList_r1.first.type);
9051      \u0275\u0275advance();
9052      \u0275\u0275property("userList", ctx.userStore.userList().ok.instagramByFacebook);
9053      \u0275\u0275advance();
9054      \u0275\u0275property("userList", ctx.userStore.userList().ok.instagramByFacebook);
9055      \u0275\u0275advance();
9056      \u0275\u0275property("userType", userList_r1.first.type);
9057      \u0275\u0275advance();
9058      \u0275\u0275property("userList", userList_r1.selected.ok.instagramByFacebook);
9059    }
9060  }, dependencies: [
9061    CommonModule,
9062    TranslatePipe,
9063    PublicationTypeComponent,
9064    LocationComponent,
9065    FirstCommentComponent,
9066    CollaboratorsComponent,
9067    MentionComponent,
9068    TagsComponent,
9069    AudioComponent,
9070    UrlShortenerComponent
9071  ], encapsulation: 2 });
9072};
9073(() => {
9074  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(InstagramComponent, [{
9075    type: Component,
9076    args: [{ selector: "app-instagram", imports: [
9077      CommonModule,
9078      TranslatePipe,
9079      PublicationTypeComponent,
9080      LocationComponent,
9081      FirstCommentComponent,
9082      CollaboratorsComponent,
9083      MentionComponent,
9084      TagsComponent,
9085      AudioComponent,
9086      UrlShortenerComponent
9087    ], template: `<section class="flex gap-12">
9088  <app-publication-type [platform]="'instagram'" />
9089
9090  <div class="flex flex-col gap-2.5">
9091    <h3 class="text-sm font-semibold">{{ 'MESSENGER.EXTRAS' | translate }}</h3>
9092
9093    <div class="flex gap-4">
9094      @let userList = store.post().userList.instagram;
9095      <app-location [userList]="userStore.userList().ok.instagramByF
9095acebook" [userType]="userList.first.type" />
9096      <app-first-comment [userList]="userList" [userType]="userList.first.type" />
9097      <app-collaborators [userList]="userStore.userList().ok.instagramByFacebook" />
9098      <app-tags [userList]="userStore.userList().ok.instagramByFacebook" />
9099      <app-mention [userType]="userList.first.type" />
9100      <app-audio [userList]="userList.selected.ok.instagramByFacebook" />
9101      <app-url-shortener />
9102    </div>
9103  </div>
9104</section>
9105` }]
9106  }], null, null);
9107})();
9108(() => {
9109  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(InstagramComponent, { className: "InstagramComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/instagram/instagram.component.ts", lineNumber: 31 });
9110})();
9111
9112// libs/socialgest/messenger/src/presenter/components/extras/telegram/components/topics/services/topics.service.ts
9113var TopicsService = class _TopicsService {
9114  http;
9115  constructor(http) {
9116    this.http = http;
9117  }
9118  search(user) {
9119    return this.http.get(`${environment.apiUrlV1}telegram/topics/${user.id}`).pipe(map((response) => esm_exports.right(response?.data?.topics ?? [])), catchError((err) => of(esm_exports.left(err))));
9120  }
9121  static \u0275fac = function TopicsService_Factory(__ngFactoryType__) {
9122    return new (__ngFactoryType__ || _TopicsService)(\u0275\u0275inject(HttpClient));
9123  };
9124  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _TopicsService, factory: _TopicsService.\u0275fac, providedIn: "root" });
9125};
9126(() => {
9127  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TopicsService, [{
9128    type: Injectable,
9129    args: [{ providedIn: "root" }]
9130  }], () => [{ type: HttpClient }], null);
9131})();
9132
9133// libs/socialgest/messenger/src/presenter/components/extras/telegram/components/topics/topics.component.ts
9134var _c012 = ["popover"];
9135var _c17 = (a0) => ({ value: a0 });
9136function TopicsComponent_Conditional_5_ng_template_4_Template(rf, ctx) {
9137  if (rf & 1) {
9138    \u0275\u0275elementStart(0, "span", 9);
9139    \u0275\u0275text(1);
9140    \u0275\u0275elementEnd();
9141  }
9142  if (rf & 2) {
9143    const segment_r4 = ctx.$implicit;
9144    \u0275\u0275advance();
9145    \u0275\u0275textInterpolate(segment_r4.label);
9146  }
9147}
9148function TopicsComponent_Conditional_5_Template(rf, ctx) {
9149  if (rf & 1) {
9150    const _r2 = \u0275\u0275getCurrentView();
9151    \u0275\u0275elementStart(0, "h3", 7);
9152    \u0275\u0275text(1);
9153    \u0275\u0275pipe(2, "translate");
9154    \u0275\u0275elementEnd();
9155    \u0275\u0275elementStart(3, "ui-segment-list", 8);
9156    \u0275\u0275listener("valueChange", function TopicsComponent_Conditional_5_Template_ui_segment_list_valueChange_3_listener($event) {
9157      \u0275\u0275restoreView(_r2);
9158      const ctx_r2 = \u0275\u0275nextContext();
9159      return \u0275\u0275resetView(ctx_r2.store.post().options.telegram.set.topic($event));
9160    });
9161    \u0275\u0275template(4, TopicsComponent_Conditional_5_ng_template_4_Template, 2, 1, "ng-template", null, 1, \u0275\u0275templateRefExtractor);
9162    \u0275\u0275elementEnd();
9163  }
9164  if (rf & 2) {
9165    const ctx_r2 = \u0275\u0275nextContext();
9166    \u0275\u0275advance();
9167    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(2, 3, "MESSENGER.TOPICS.SELECT_TOPIC"), " ");
9168    \u0275\u0275advance(2);
9169    \u0275\u0275property("segments", ctx_r2.topics())("selected", \u0275\u0275pureFunction1(5, _c17, ctx_r2.store.post().options.telegram.topic));
9170  }
9171}
9172function TopicsComponent_Conditional_6_Template(rf, ctx) {
9173  if (rf & 1) {
9174    \u0275\u0275element(0, "ui-skeleton-list", 5);
9175  }
9176  if (rf & 2) {
9177    \u0275\u0275property("count", 1)("width", "100%")("height", "100%");
9178  }
9179}
9180function TopicsComponent_Conditional_7_Template(rf, ctx) {
9181  if (rf & 1) {
9182    \u0275\u0275elementStart(0, "div", 6);
9183    \u0275\u0275element(1, "ui-icon", 10);
9184    \u0275\u0275elementStart(2, "h2", 11);
9185    \u0275\u0275text(3);
9186    \u0275\u0275pipe(4, "translate");
9187    \u0275\u0275elementEnd();
9188    \u0275\u0275elementStart(5, "p", 12);
9189    \u0275\u0275text(6);
9190    \u0275\u0275pipe(7, "translate");
9191    \u0275\u0275elementEnd()();
9192  }
9193  if (rf & 2) {
9194    \u0275\u0275advance();
9195    \u0275\u0275property("name", "folder-open")("strokeWidth", 1);
9196    \u0275\u0275advance(2);
9197    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 4, "MESSENGER.TOPICS.NO_TOPICS"));
9198    \u0275\u0275advance(3);
9199    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(7, 6, "MESSENGER.TOPICS.NO_TOPICS_DESCRIPTION"), " ");
9200  }
9201}
9202var TopicsComponent = class _TopicsComponent {
9203  userList = input.required();
9204  topicsService = inject(TopicsService);
9205  store = inject(MessengerStore);
9206  toast = inject(SonnerToasterService);
9207  popover = viewChild.required("popover");
9208  isLoading = signal(false);
9209  topics = signal([]);
9210  ngOnInit() {
9211    const firstUser = this.userList()?.first;
9212    if (!firstUser)
9213      return;
9214    this.isLoading.set(true);
9215    this.topicsService.search(firstUser).subscribe((result) => {
9216      result.mapRight((_) => this.topics.set(_.map(({ id, title }) => ({ label: title, value: id }))));
9217      this.isLoading.set(false);
9218    });
9219  }
9220  open(event) {
9221    if (this.userList().length > 1) {
9222      this.toast.warning("MESSENGER.TOPICS.MULTIPLE_GROUPS_NOT_ALLOWED");
9223    } else {
9224      this.popover().show(event);
9225    }
9226  }
9227  static \u0275fac = function TopicsComponent_Factory(__ngFactoryType__) {
9228    return new (__ngFactoryType__ || _TopicsComponent)();
9229  };
9230  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _TopicsComponent, selectors: [["app-topics"]], viewQuery: function TopicsComponent_Query(rf, ctx) {
9231    if (rf & 1) {
9232      \u0275\u0275viewQuerySignal(ctx.popover, _c012, 5);
9233    }
9234    if (rf & 2) {
9235      \u0275\u0275queryAdvance();
9236    }
9237  }, inputs: { userList: [1, "userList"] }, decls: 8, vars: 11, consts: [["popover", ""], ["item", ""], ["icon", "send", 1, "curs
9237or-pointer", 3, "click", "variant", "severity", "tooltip", "tooltipPosition", "positionTop", "styleClass"], ["styleClass", "w-[15rem] -mt-5! no-gutter"], [1, "h-[17rem]", "grid", "grid-rows-[auto_1fr]", "p-5", "gap-2"], ["styleClass", "h-[15rem]", 3, "count", "width", "height"], [1, "flex", "flex-col", "items-center", "gap-2", "text-center", "mt-10"], [1, "text-sm", "font-semibold", "text-grey-500"], ["itemStyleClass", "h-9! rounded-md! border-grey-100 px-4! py-1.5!", 1, "segment-thin", 2, "--p-card-body-padding", "0", 3, "valueChange", "segments", "selected"], [1, "block", "w-full", "font-display", "text-sm", "font-semibold", "truncate"], ["styleClass", "text-grey-100 size-10", 3, "name", "strokeWidth"], [1, "text-md", "font-semibold", "text-grey-500"], [1, "text-sm", "text-grey-300"]], template: function TopicsComponent_Template(rf, ctx) {
9238    if (rf & 1) {
9239      const _r1 = \u0275\u0275getCurrentView();
9240      \u0275\u0275elementStart(0, "ui-button", 2);
9241      \u0275\u0275pipe(1, "translate");
9242      \u0275\u0275listener("click", function TopicsComponent_Template_ui_button_click_0_listener($event) {
9243        \u0275\u0275restoreView(_r1);
9244        return \u0275\u0275resetView(ctx.open($event));
9245      });
9246      \u0275\u0275elementEnd();
9247      \u0275\u0275elementStart(2, "ui-popover", 3, 0)(4, "article", 4);
9248      \u0275\u0275conditionalCreate(5, TopicsComponent_Conditional_5_Template, 6, 7)(6, TopicsComponent_Conditional_6_Template, 1, 3, "ui-skeleton-list", 5)(7, TopicsComponent_Conditional_7_Template, 8, 8, "div", 6);
9249      \u0275\u0275elementEnd()();
9250    }
9251    if (rf & 2) {
9252      const popover_r5 = \u0275\u0275reference(3);
9253      const hasTopic_r6 = ctx.store.post().options.telegram.has.topic;
9254      \u0275\u0275property("styleClass", \u0275\u0275interpolate2("\n  ", popover_r5.isOpen() && "bg-grey-50!", "\n  ", hasTopic_r6 && " bg-secondary-50!"))("variant", hasTopic_r6 ? "outlined" : void 0)("severity", hasTopic_r6 ? "secondary" : "contrast")("tooltip", \u0275\u0275pipeBind1(1, 9, "MESSENGER.TOPICS.TITLE"))("tooltipPosition", "top")("positionTop", -10);
9255      \u0275\u0275advance(5);
9256      \u0275\u0275conditional(!ctx.isLoading() && ctx.topics().length > 0 ? 5 : ctx.isLoading() ? 6 : 7);
9257    }
9258  }, dependencies: [
9259    CommonModule,
9260    TranslatePipe,
9261    PopoverComponent,
9262    ButtonComponent,
9263    TooltipDirective,
9264    SegmentListComponent,
9265    IconComponent,
9266    SkeletonListComponent
9267  ], encapsulation: 2 });
9268};
9269(() => {
9270  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TopicsComponent, [{
9271    type: Component,
9272    args: [{ selector: "app-topics", imports: [
9273      CommonModule,
9274      TranslatePipe,
9275      PopoverComponent,
9276      ButtonComponent,
9277      TooltipDirective,
9278      SegmentListComponent,
9279      IconComponent,
9280      SkeletonListComponent
9281    ], template: `@let hasTopic = store.post().options.telegram.has.topic;
9282
9283<ui-button
9284  (click)="open($event)"
9285  icon="send"
9286  [variant]="hasTopic ? 'outlined' : undefined"
9287  [severity]="hasTopic ? 'secondary' : 'contrast'"
9288  [tooltip]="'MESSENGER.TOPICS.TITLE' | translate"
9289  [tooltipPosition]="'top'"
9290  [positionTop]="-10"
9291  class="cursor-pointer"
9292  styleClass="
9293  {{ popover.isOpen() && 'bg-grey-50!' }}
9294  {{ hasTopic && ' bg-secondary-50!' }}"
9295/>
9296
9297<ui-popover #popover styleClass="w-[15rem] -mt-5! no-gutter">
9298  <article class="h-[17rem] grid grid-rows-[auto_1fr] p-5 gap-2">
9299    @if(!isLoading() && topics().length > 0) {
9300    <h3 class="text-sm font-semibold text-grey-500">
9301      {{ 'MESSENGER.TOPICS.SELECT_TOPIC' | translate }}
9302    </h3>
9303
9304    <ui-segment-list
9305      (valueChange)="store.post().options.telegram.set.topic($event)"
9306      [segments]="topics()"
9307      [selected]="{ value: store.post().options.telegram.topic }"
9308      itemStyleClass="h-9! rounded-md! border-grey-100 px-4! py-1.5!"
9309      class="segment-thin"
9310      style="--p-card-body-padding: 0"
9311    >
9312      <ng-template #item let-segment>
9313        <span class="block w-full font-display text-sm font-semibold truncate">{{ segment.label }}</span>
9314      </ng-template>
9315    </ui-segment-list>
9316    }@else if(isLoading()){
9317    <ui-skeleton-list [count]="1" [width]="'100%'" [height]="'100%'" styleClass="h-[15rem]" />
9318    } @else{
9319    <div class="flex flex-col items-center gap-2 text-center mt-10">
9320      <ui-icon [name]="'folder-open'" [strokeWidth]="1" styleClass="text-grey-100 size-10" />
9321      <h2 class="text-md font-semibold text-grey-500">{{ 'MESSENGER.TOPICS.NO_TOPICS' | translate }}</h2>
9322      <p class="text-sm text-grey-300">
9323        {{ 'MESSENGER.TOPICS.NO_TOPICS_DESCRIPTION' | translate }}
9324      </p>
9325    </div>
9326    }
9327  </article>
9328</ui-popover>
9329` }]
9330  }], null, null);
9331})();
9332(() => {
9333  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(TopicsComponent, { className: "TopicsComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/telegram/components/topics/topics.component.ts", lineNumber: 25 });
9334})();
9335
9336// libs/socialgest/messenger/src/presenter/components/extras/telegram/telegram.component.ts
9337var TelegramComponent = class _TelegramComponent {
9338  store = inject(MessengerStore);
9339  static \u0275fac = function TelegramComponent_Factory(__ngFactoryType__) {
9340    return new (__ngFactoryType__ || _TelegramComponent)();
9341  };
9342  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _TelegramComponent, selectors: [["app-telegram"]], decls: 7, vars: 4, consts: [[1, "flex", "flex-col", "gap-2.5"], [1, "text-sm", "font-semibold"], [1, "flex", "gap-4"], [3, "userList"]], template: function TelegramComponent_Template(rf, ctx) {
9343    if (rf & 1) {
9344      \u0275\u0275elementStart(0, "div", 0)(1, "h3", 1);
9345      \u0275\u0275text(2);
9346      \u0275\u0275pipe(3, "translate");
9347      \u0275\u0275elementEnd();
9348      \u0275\u0275elementStart(4, "div", 2);
9349      \u0275\u0275element(5, "app-topics", 3)(6, "app-url-shortener");
9350      \u0275\u0275elementEnd()();
9351    }
9352    if (rf & 2) {
9353      \u0275\u0275advance(2);
9354      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(3, 2, "MESSENGER.EXTRAS"));
9355      \u0275\u0275advance(3);
9356      \u0275\u0275property("userList", ctx.store.post.userList().ok.telegram);
9357    }
9358  }, dependencies: [CommonModule, TranslatePipe, TopicsComponent, UrlShortenerComponent], encapsulation: 2 });
9359};
9360(() => {
9361  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TelegramComponent, [{
9362    type: Component,
9363    args: [{ selector: "app-telegram", imports: [CommonModule, TranslatePipe, TopicsComponent, UrlShortenerComponent], template: `<div class="flex flex-col gap-2.5">
9364  <h3 class="text-sm font-semibold">{{ 'MESSENGER.EXTRAS' | translate }}</h3>
9365
9366  <div class="flex gap-4">
9367    <app-topics [userList]="store.post.userList().ok.telegram" />
9368    <app-url-shortener />
9369  </div>
9370</div>
9371` }]
9372  }], null, null);
9373})();
9374(() => {
9375  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(TelegramComponent, { className: "TelegramComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/telegram/telegram.component.ts", lineNumber: 13 });
9376})();
9377
9378// libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/domain/music-track.ts
9379var MusicTrack = class _MusicTrack extends Entity {
9380  title;
9381  artist;
9382  thumbnail;
9383  trending;
9384  full;
9385  clipMode;
9386  constructor(title, artist, thumbnail, trending, full, clipMode = "trending") {
9387    super();
9388    this.title = title;
9389    this.artist = artist;
9390    this.thumbnail = thumbnail;
9391    this.trending = trending;
9392    this.full = full;
9393    this.clipMode = clipMode;
9394  }
9395  get active() {
9396    return this.clipMode === "full" ? this.full : this.trending;
9397  }
9398  get activeId() {
9399    return this.active.id;
9400  }
9401  get activePreviewUrl() {
9402    return this.active.previewUrl;
9403  }
9404  get activeDuration() {
9405    return this.active.duration;
9406  }
9407  withMode(mode) {
9408    return new _MusicTrack(this.title, this.artist, this.thumbnail, this.trending, this.full, mode).withId(this.id);
9409  }
9410  static from(primitives) {
9411    return new _MusicTrack(primitives.title, primitives.artist, primitives.thumbnail, primitives.trending, primitives.full, primitives.clipMode ?? "trending");
9412  }
9413};
9414
9415// libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/domain/music-track-list.ts
9416var MusicTrackList = class _MusicTrackList extends EntityList {
9417  tracks;
9418  constructor(tracks) {
9419    super(_MusicTrackList, tracks);
9420    this.tracks = tracks;
9421  }
9422  search(term) {
9423    const normalized = term.toLowerCase().trim();
9424    return this.filter((track) => track.title.toLowerCase().includes(normalized) || track.artist.toLowerCase().includes(normalized));
9425  }
9426  static from(tracks) {
9427    return new _MusicTrackList(tracks);
9428  }
9429  static empty() {
9430    return new _MusicTrackList([]);
9431  }
9432};
9433
9434// libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/mappers/music-track.mapper.ts
9435var MusicTrackMapper = class {
9436  static toDomain(entities) {
9437    return entities.filter((entity) => entity.trending_song_clip?.song_clip_id && entity.full_duration_song_clip?.song_clip_id).map((entity) => MusicTrack.from({
9438      title: entity.commercial_music_name,
9439      artist: entity.artist,
9440      thumbnail: entity.thumbnail_url,
9441      trending: {
9442        id: entity.trending_song_clip.song_clip_id,
9443        previewUrl: entity.trending_song_clip.preview_url,
9444        duration: entity.trending_song_clip.duration
9445      },
9446      full: {
9447        id: entity.full_duration_song_clip.song_clip_id,
9448        previewUrl: entity.full_duration_song_clip.preview_url,
9449        duration: entity.full_duration_song_clip.duration
9450      }
9451    }));
9452  }
9453};
9454
9455// libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/services/music-error.service.ts
9456var MAP_ERRORS7 = {
9457  3: () => "GLOBAL.ERROR.PERMISSION_DENIED",
9458  504: () => "MESSENGER.ERROR.TIMEOUT",
9459  1010: () => "MESSENGER.ERROR.RATE_LIMIT",
9460  40001: () => "MESSENGER.TIKTOK.MUSIC_ERROR.BUSINESS_ONLY",
9461  40105: () => "MESSENGER.TIKTOK.MUSIC_ERROR.TOKEN_REVOKED"
9462};
9463var from5 = (response) => {
9464  return new Exception(MAP_ERRORS7[response.error?.meta?.code]?.(response) ?? "GLOBAL.ERROR.UNEXPECTED");
9465};
9466
9467// libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/services/music.service.ts
9468var MusicService = class _MusicService {
9469  http;
9470  constructor(http) {
9471    this.http = http;
9472  }
9473  search(userId, options = {}) {
9474    const params = {};
9475    if (options.genre)
9476      params["genre"] = options.genre;
9477    if (options.countryCode)
9478      params["country_code"] = options.countryCode;
9479    return this.http.get(`${environment.apiUrlV1}tiktok_business/music_library/${userId}`, { params }).pipe(map((response) => esm_exports.right(MusicTrackMapper.toDomain(response?.data?.list ?? []))), catchError((err) => of(esm_exports.left(from5(err)))));
9480  }
9481  static \u0275fac = function MusicService_Factory(__ngFactoryType__) {
9482    return new (__ngFactoryType__ || _MusicService)(\u0275\u0275inject(HttpClient));
9483  };
9484  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _MusicService, factory: _MusicService.\u0275fac, providedIn: "root" });
9485};
9486(() => {
9487  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MusicService, [{
9488    type: Injectable,
9489    args: [{ providedIn: "root" }]
9490  }], () => [{ type: HttpClient }], null);
9491})();
9492
9493// libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/components/music-dialog/services/music-player.service.ts
9494var MusicPlayerService = class _MusicPlayerService {
9495  audio = new Audio();
9496  playingId = signal(null);
9497  stopAt = null;
9498  constructor() {
9499    this.audio.addEventListener("ended", () => this.playingId.set(null));
9500    this.audio.addEventListener("timeupdate", () => {
9501      if (this.stopAt !== null && this.audio.currentTime >= this.stopAt) {
9502        this.audio.pause();
9503        this.playingId.set(null);
9504        this.stopAt = null;
9505      }
9506    });
9507  }
9508  toggle(id, url) {
9509    this.stopAt = null;
9510    if (this.playingId() === id) {
9511      this.audio.pause();
9512      this.playingId.set(null);
9513    } else {
9514      this.audio.src = url;
9515      this.audio.play();
9516      this.playingId.set(id);
9517    }
9518  }
9519  playSegment(id, url, startSec, endSec) {
9520    if (this.playingId() === id) {
9521      this.audio.pause();
9522      this.playingId.set(null);
9523      this.stopAt = null;
9524    } else {
9525      this.stopAt = endSec;
9526      this.audio.src = url;
9527      this.audio.currentTime = startSec;
9528      this.audio.play();
9529      this.playingId.set(id);
9530    }
9531  }
9532  stopIfPlaying(id) {
9533    if (this.playingId() === id) {
9534      this.audio.pause();
9535      this.playingId.set(null);
9536      this.stopAt = null;
9537    }
9538  }
9539  ngOnDestroy() {
9540    this.audio.pause();
9541  }
9542  static \u0275fac = function MusicPlayerService_Factory(__ngFactoryType__) {
9543    return new (__ngFactoryType__ || _MusicPlayerService)();
9544  };
9545  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _MusicPlayerService, factory: _MusicPlayerService.\u0275fac });
9546};
9547(() => {
9548  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MusicPlayerService, [{
9549    type: Injectable
9550  }], () => [], null);
9551})();
9552
9553// libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/components/music-dialog/components/music-search/components/music-selected-track/music-selected-track.component.ts
9554function MusicSelectedTrackComponent_Conditional_2_Template(rf, ctx) {
9555  if (rf & 1) {
9556    \u0275\u0275element(0, "img", 2);
9557  }
9558  if (rf & 2) {
9559    const ctx_r0 = \u0275\u0275nextContext();
9560    \u0275\u0275property("src", ctx_r0.track().thumbnail, \u0275\u0275sanitizeUrl);
9561  }
9562}
9563var MusicSelectedTrackComponent = class _MusicSelectedTrackComponent {
9564  track = input.required();
9565  edit = output();
9566  remove = output();
9567  static \u0275fac = function MusicSelectedTrackComponent_Factory(__ngFactoryType__) {
9568    return new (__ngFactoryType__ || _MusicSelectedTrackComponent)();
9569  };
9570  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _MusicSelectedTrackComponent, selectors: [["app-music-selected-track"]], inputs: { track: [1, "track"] }, outputs: { edit: "edit", remove: "remove" }, decls: 15, vars: 14, consts: [[1, "flex", "items-center", "gap-4", "px-3", "py-2"], [1, "size-11", "rounded-md", "bg-grey-100", "overflow-hidden", "flex-shrink-0"], ["alt", "Song cover", 1, "size-full", "object-cover", 3, "src"], [1, "flex-1", "min-w-0", "space-y-1"], [1, "text-sm", "font-semibold", "truncate", "font-display"], [1, "text-xs", "text-grey-500", "font-medium", "font-display"], ["tooltipPosition", "top", "severity", "contrast", "size", "small", 3, "click", "label", "tooltip", "fluid"], [1, "cursor-pointer", "text-grey-500", 3, "click"], ["name", "circleX", 3, "size"], [1, "border-grey-50", "mb-3"]], template: function MusicSelectedTrackComponent_Template(rf, ctx) {
9571    if (rf & 1) {
9572      \u0275\u0275elementStart(0, "div", 0)(1, "div", 1);
9573      \u0275\u0275conditionalCreate(2, MusicSelectedTrackComponent_Conditional_2_Template, 1, 1, "img", 2);
9574      \u0275\u0275elementEnd();
9575      \u0275\u0275elementStart(3, "div", 3)(4, "p", 4);
9576      \u0275\u0275text(5);
9577      \u0275\u0275elementEnd();
9578      \u0275\u0275elementStart(6, "p", 5);
9579      \u0275\u0275text(7);
9580      \u0275\u0275pipe(8, "formatDuration");
9581      \u0275\u0275elementEnd()();
9582      \u0275\u0275elementStart(9, "ui-button", 6);
9583      \u0275\u0275pipe(10, "translate");
9584      \u0275\u0275pipe(11, "translate");
9585      \u0275\u0275listener("click", function MusicSelectedTrackComponent_Template_ui_button_click_9_listener() {
9586        return ctx.edit.emit();
9587      });
9588      \u0275\u0275elementEnd();
9589      \u0275\u0275elementStart(12, "button", 7);
9590      \u0275\u0275listener("click", function MusicSelectedTrackComponent_Template_button_click_12_listener() {
9591        return ctx.remove.emit();
9592      });
9593      \u0275\u0275element(13, "ui-icon", 8);
9594      \u0275\u0275elementEnd()();
9595      \u0275\u0275element(14, "hr", 9);
9596    }
9597    if (rf & 2) {
9598      \u0275\u0275advance(2);
9599      \u0275\u0275conditional(ctx.track().thumbnail ? 2 : -1);
9600      \u0275\u0275advance(3);
9601      \u0275\u0275textInterpolate(ctx.track().title);
9602      \u0275\u0275advance(2);
9603      \u0275\u0275textInterpolate2(" ", \u0275\u0275pipeBind1(8, 8, ctx.track().activeDuration), " \xB7 ", ctx.track().artist, " ");
9604      \u0275\u0275advance(2);
9605      \u0275\u0275property("label", \u0275\u0275pipeBind1(10, 10, "MESSENGER.TIKTOK.MUSIC_EDIT"))("tooltip", \u0275\u0275pipeBind1(11, 12, "MESSENGER.TIKTOK.MUSIC_EDIT_VIDEO_TOOLTIP"))("fluid", false);
9606      \u0275\u0275advance(4);
9607      \u0275\u0275property("size", 18);
9608    }
9609  }, dependencies: [TranslatePipe, FormatDurationPipe, ButtonComponent, IconComponent, TooltipDirective], encapsulation: 2 });
9610};
9611(() => {
9612  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MusicSelectedTrackComponent, [{
9613    type: Component,
9614    args: [{ selector: "app-music-selected-track", imports: [TranslatePipe, FormatDurationPipe, ButtonComponent, IconComponent, TooltipDirective], template: `<div class="flex items-center gap-4 px-3 py-2">
9615  <div class="size-11 rounded-md bg-grey-100 overflow-hidden flex-shrink-0">
9616    @if (track().thumbnail) {
9617    <img [src]="track().thumbnail" class="size-full object-cover" alt="Song cover" />
9618    }
9619  </div>
9620
9621  <div class="flex-1 min-w-0 space-y-1">
9622    <p class="text-sm font-semibold truncate font-display">{{ track().title }}</p>
9623    <p class="text-xs text-grey-500 font-medium font-display">
9624      {{ track().activeDuration | formatDuration }} \xB7 {{ track().artist }}
9625    </p>
9626  </div>
9627
9628  <ui-button
9629    (click)="edit.emit()"
9630    [label]="'MESSENGER.TIKTOK.MUSIC_EDIT' | translate"
9631    [tooltip]="'MESSENGER.TIKTOK.MUSIC_EDIT_VIDEO_TOOLTIP' | translate"
9632    tooltipPosition="top"
9633    severity="contrast"
9634    size="small"
9635    [fluid]="false"
9636  />
9637
9638  <button (click)="remove.emit()" class="cursor-pointer text-grey-500">
9639    <ui-icon name="circleX" [size]="18" />
9640  </button>
9641</div>
9642
9643<hr class="border-grey-50 mb-3" />
9644` }]
9645  }], null, null);
9646})();
9647(() => {
9648  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(MusicSelectedTrackComponent, { className: "MusicSelectedTrackComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/components/music-dialog/components/music-search/components/music-selected-track/music-selected-track.component.ts", lineNumber: 11 });
9649})();
9650
9651// libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/components/music-dialog/components/music-search/components/music-track-item/music-track-item.component.ts
9652function MusicTrackItemComponent_Conditional_2_Template(rf, ctx) {
9653  if (rf & 1) {
9654    \u0275\u0275element(0, "img", 2);
9655  }
9656  if (rf & 2) {
9657    const ctx_r0 = \u0275\u0275nextContext();
9658    \u0275\u0275property("src", ctx_r0.track().thumbnail, \u0275\u0275sanitizeUrl)("alt", ctx_r0.track().title);
9659  }
9660}
9661var MusicTrackItemComponent = class _MusicTrackItemComponent {
9662  track = input.required();
9663  selected = input(false);
9664  select = output();
9665  player = inject(MusicPlayerService);
9666  isPlaying = computed(() => this.player.playingId() === this.track().activeId);
9667  toggle() {
9668    this.player.toggle(this.track().activeId, this.track().activePreviewUrl);
9669  }
9670  ngOnDestroy() {
9671    this.player.stopIfPlaying(this.track().activeId);
9672  }
9673  static \u0275fac = function MusicTrackItemComponent_Factory(__ngFactoryType__) {
9674    return new (__ngFactoryType__ || _MusicTrackItemComponent)();
9675  };
9676  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _MusicTrackItemComponent, selectors: [["app-music-track-item"]], inputs: { track: [1, "track"], selected: [1, "selected"] }, outputs: { select: "select" }, decls: 11, vars: 13, consts: [["tabindex", "0", "role", "option", 1, "flex", "items-center", "gap-4", "px-3", "py-2.5", "rounded-lg", "cursor-pointer", "transition-colors", 3, "click", "keydown.enter", "keydown.space"], [1, "size-11", "rounded-md", "bg-grey-100", "overflow-hidden", "flex-shrink-0"], [1, "size-full", "object-cover", 3, "src", "alt"], [1, "flex-1", "min-w-0", "space-y-1"], [1, "text-sm", "font-semibold", "truncate", "font-display"], [1, "text-xs", "text-grey-500", "font-medium", "font-display"], [1, "cursor-pointer", "text-grey-500", 3, "click"], [3, "name", "size"]], template: function MusicTrackItemComponent_Template(rf, ctx) {
9677    if (rf & 1) {
9678      \u0275\u0275elementStart(0, "li", 0);
9679      \u0275\u0275listener("click", function MusicTrackItemComponent_Template_li_click_0_listener() {
9680        return ctx.select.emit();
9681      })("keydown.enter", function MusicTrackItemComponent_Template_li_keydown_enter_0_listener() {
9682        return ctx.select.emit();
9683      })("keydown.space", function MusicTrackItemComponent_Template_li_keydown_space_0_listener($event) {
9684        $event.preventDefault();
9685        return ctx.select.emit();
9686      });
9687      \u0275\u0275elementStart(1, "div", 1);
9688      \u0275\u0275conditionalCreate(2, MusicTrackItemComponent_Conditional_2_Template, 1, 2, "img", 2);
9689      \u0275\u0275elementEnd();
9690      \u0275\u0275elementStart(3, "div", 3)(4, "p", 4);
9691      \u0275\u0275text(5);
9692      \u0275\u0275elementEnd();
9693      \u0275\u0275elementStart(6, "p", 5);
9694      \u0275\u0275text(7);
9695      \u0275\u0275pipe(8, "formatDuration");
9696      \u0275\u0275elementEnd()();
9697      \u0275\u0275elementStart(9, "button", 6);
9698      \u0275\u0275listener("click", function MusicTrackItemComponent_Template_button_click_9_listener($event) {
9699        $event.stopPropagation();
9700        return ctx.toggle();
9701      });
9702      \u0275\u0275element(10, "ui-icon", 7);
9703      \u0275\u0275elementEnd()();
9704    }
9705    if (rf & 2) {
9706      \u0275\u0275classProp("bg-secondary-50", ctx.selected())("hover:bg-grey-50", !ctx.selected());
9707      \u0275\u0275attribute("aria-selected", ctx.selected());
9708      \u0275\u0275advance(2);
9709      \u0275\u0275conditional(ctx.track().thumbnail ? 2 : -1);
9710      \u0275\u0275advance(3);
9711      \u0275\u0275textInterpolate(ctx.track().title);
9712      \u0275\u0275advance(2);
9713      \u0275\u0275textInterpolate2(" ", \u0275\u0275pipeBind1(8, 11, ctx.track().activeDuration), " \xB7 ", ctx.track().artist, " ");
9714      \u0275\u0275advance(3);
9715      \u0275\u0275property("name", ctx.isPlaying() ? "pause" : "play")("size", 20);
9716    }
9717  }, dependencies: [FormatDurationPipe, IconComponent], encapsulation: 2 });
9718};
9719(() => {
9720  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MusicTrackItemComponent, [{
9721    type: Component,
9722    args: [{ selector: "app-music-track-item", imports: [FormatDurationPipe, IconComponent], template: `<li
9723  (click)="select.emit()"
9724  (keydown.enter)="select.emit()"
9725  (keydown.space)="$event.preventDefault(); select.emit()"
9726  tabindex="0"
9727  role="option"
9728  [attr.aria-selected]="selected()"
9729  class="flex items-center gap-4 px-3 py-2.5 rounded-lg cursor-pointer transition-colors"
9730  [class.bg-secondary-50]="selected()"
9731  [class.hover:bg-grey-50]="!selected()"
9732>
9733  <div class="size-11 rounded-md bg-grey-100 overflow-hidden flex-shrink-0">
9734    @if (track().thumbnail) {
9735    <img [src]="track().thumbnail" class="size-full object-cover" [alt]="track().title" />
9736    }
9737  </div>
9738
9739  <div class="flex-1 min-w-0 space-y-1">
9740    <p class="text-sm font-semibold truncate font-display">{{ track().title }}</p>
9741    <p class="text-xs text-grey-500 font-medium font-display">
9742      {{ track().activeDuration | formatDuration }} \xB7 {{ track().artist }}
9743    </p>
9744  </div>
9745
9746  <button (click)="$event.stopPropagation(); toggle()" class="cursor-pointer text-grey-500">
9747    <ui-icon [name]="isPlaying() ? 'pause' : 'play'" [size]="20" />
9748  </button>
9749</li>
9750` }]
9751  }], null, null);
9752})();
9753(() => {
9754  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(MusicTrackItemComponent, { className: "MusicTrackItemComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/components/music-dialog/components/music-search/components/music-track-item/music-track-item.component.ts", lineNumber: 12 });
9755})();
9756
9757// libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/components/music-dialog/components/music-search/music-search.component.ts
9758var _forTrack05 = ($index, $item) => $item.id;
9759function MusicSearchComponent_Conditional_9_Template(rf, ctx) {
9760  if (rf & 1) {
9761    const _r1 = \u0275\u0275getCurrentView();
9762    \u0275\u0275elementStart(0, "app-music-selected-track", 9);
9763    \u0275\u0275listener("edit", function MusicSearchComponent_Conditional_9_Template_app_music_selected_track_edit_0_listener() {
9764      \u0275\u0275restoreView(_r1);
9765      const ctx_r1 = \u0275\u0275nextContext();
9766      return \u0275\u0275resetView(ctx_r1.goToEdit.emit());
9767    })("remove", function MusicSearchComponent_Conditional_9_Template_app_music_selected_track_remove_0_listener() {
9768      \u0275\u0275restoreView(_r1);
9769      const ctx_r1 = \u0275\u0275nextContext();
9770      return \u0275\u0275resetView(ctx_r1.trackSelected.emit(null));
9771    });
9772    \u0275\u0275elementEnd();
9773  }
9774  if (rf & 2) {
9775    const ctx_r1 = \u0275\u0275nextContext();
9776    \u0275\u0275property("track", ctx_r1.selectedTrack());
9777  }
9778}
9779function MusicSearchComponent_Conditional_10_For_2_Template(rf, ctx) {
9780  if (rf & 1) {
9781    const _r3 = \u0275\u0275getCurrentView();
9782    \u0275\u0275elementStart(0, "app-music-track-item", 11);
9783    \u0275\u0275listener("select", function MusicSearchComponent_Conditional_10_For_2_Template_app_music_track_item_select_0_listener() {
9784      const t_r4 = \u0275\u0275restoreView(_r3).$implicit;
9785      const ctx_r1 = \u0275\u0275nextContext(2);
9786      return \u0275\u0275resetView(ctx_r1.trackSelected.emit(t_r4));
9787    });
9788    \u0275\u0275elementEnd();
9789  }
9790  if (rf & 2) {
9791    let tmp_12_0;
9792    const t_r4 = ctx.$implicit;
9793    const ctx_r1 = \u0275\u0275nextContext(2);
9794    \u0275\u0275property("track", t_r4)("selected", ((tmp_12_0 = ctx_r1.selectedTrack()) == null ? null : tmp_12_0.id) === t_r4.id);
9795  }
9796}
9797function MusicSearchComponent_Conditional_10_Template(rf, ctx) {
9798  if (rf & 1) {
9799    \u0275\u0275elementStart(0, "ul", 7);
9800    \u0275\u0275repeaterCreate(1, MusicSearchComponent_Conditional_10_For_2_Template, 1, 2, "app-music-track-item", 10, _forTrack05);
9801    \u0275\u0275elementEnd();
9802  }
9803  if (rf & 2) {
9804    const ctx_r1 = \u0275\u0275nextContext();
9805    \u0275\u0275advance();
9806    \u0275\u0275repeater(ctx_r1.tracks().items);
9807  }
9808}
9809function MusicSearchComponent_Conditional_11_Template(rf, ctx) {
9810  if (rf & 1) {
9811    \u0275\u0275elementStart(0, "div", 8);
9812    \u0275\u0275element(1, "ui-empty-list", 12);
9813    \u0275\u0275elementEnd();
9814  }
9815  if (rf & 2) {
9816    const ctx_r1 = \u0275\u0275nextContext();
9817    \u0275\u0275advance();
9818    \u0275\u0275property("hasItems", true)("noResultsLabel", "GLOBAL.EMPTY.NO_RESULTS_LIST_TITLE")("noResultsDescription", "GLOBAL.EMPTY.NO_RESULTS_LIST_DESC")("isScreenView", false)("isLoading", ctx_r1.isLoading())("width", "100%")("height", "100%");
9819  }
9820}
9821var MusicSearchComponent = class _MusicSearchComponent {
9822  userList = input.required();
9823  selectedTrack = input(null);
9824  filterGenre = input("");
9825  filterCountry = input("");
9826  trackSelected = output();
9827  goToFilter = output();
9828  goToEdit = output();
9829  musicService = inject(MusicService);
9830  toast = inject(SonnerToasterService);
9831  allTracks = signal(MusicTrackList.empty());
9832  isLoading = signal(false);
9833  searchQuery = signal("");
9834  tracks = computed(() => this.allTracks().search(this.searchQuery()));
9835  userId = computed(() => String(this.userList().first?.id ?? ""));
9836  constructor() {
9837    effect(() => {
9838      const genre = this.filterGenre();
9839      const country = this.filterCountry();
9840      const id = this.userId();
9841      if (id)
9842        this.search(id, genre, country);
9843    });
9844  }
9845  search(userId, genre, country) {
9846    this.isLoading.set(true);
9847    this.musicService.search(userId, { genre: genre || void 0, countryCode: country || void 0 }).subscribe((result) => {
9848      result.mapRight((tracks) => this.allTracks.set(MusicTrackList.from(tracks))).mapLeft((err) => this.toast.error(new Exception(err.message)));
9849      this.isLoading.set(false);
9850    });
9851  }
9852  static \u0275fac = function MusicSearchComponent_Factory(__ngFactoryType__) {
9853    return new (__ngFactoryType__ || _MusicSearchComponent)();
9854  };
9855  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _MusicSearchComponent, selectors: [["app-music-search"]], inputs: { userList: [1, "userList"], selectedTrack: [1, "selectedTrack"], filterGenre: [1, "filterGenre"], filterCountry: [1, "filterCountry"] }, outputs: { trackSelected: "trackSelected", goToFilter: "goToFilter", goToEdit: "goToEdit" }, features: [\u0275\u0275ProvidersFeature([MusicPlayerService])], decls: 12, vars: 8, consts: [[1, "w-[28rem]", "h-[33rem]", "flex", "flex-col", "gap-4", "p-5", "pb-2"], [1, "flex", "items-center", "justify-between"], [1, "text-base", "font-semibold"], [1, "flex", "items-center", "gap-3"], ["size", "small", 1, "w-full", 3, "valueChange", "placeholder"], ["icon", "listFilter", "severity", "contrast", "styleClass", "size-9! aspect-square", 3, "click"], [3, "track"], [1, "flex-1", "overflow-y-auto"], [1, "flex-1"], [3, "edit", "remove", "track"], [3, "track", "selected"], [3, "select", "track", "selected"], ["emptyTitleStyleClass", "text-md! px-0!", "emptyDescriptionStyleClass", "text-sm! px-0!", "emptyStyleClass", "gap-2! mt-20!", "iconStyleClass", "size-16!", 3, "hasItems", "noResultsLabel", "noResultsDescription", "isScreenView", "isLoading", "width", "height"]], template: function MusicSearchComponent_Template(rf, ctx) {
9856    if (rf & 1) {
9857      \u0275\u0275elementStart(0, "article", 0)(1, "header", 1)(2, "h2", 2);
9858      \u0275\u0275text(3);
9859      \u0275\u0275pipe(4, "translate");
9860      \u0275\u0275elementEnd()();
9861      \u0275\u0275elementStart(5, "div", 3)(6, "ui-input-search", 4);
9862      \u0275\u0275pipe(7, "translate");
9863      \u0275\u0275listener("valueChange", function MusicSearchComponent_Template_ui_input_search_valueChange_6_listener($event) {
9864        return ctx.searchQuery.set($event);
9865      });
9866      \u0275\u0275elementEnd();
9867      \u0275\u0275elementStart(8, "ui-button", 5);
9868      \u0275\u0275listener("click", function MusicSearchComponent_Template_ui_button_click_8_listener() {
9869        return ctx.goToFilter.emit();
9870      });
9871      \u0275\u0275elementEnd()();
9872      \u0275\u0275conditionalCreate(9, MusicSearchComponent_Conditional_9_Template, 1, 1, "app-music-selected-track", 6);
9873      \u0275\u0275conditionalCreate(10, MusicSearchComponent_Conditional_10_Template, 3, 0, "ul", 7)(11, MusicSearchComponent_Conditional_11_Template, 2, 7, "div", 8);
9874      \u0275\u0275elementEnd();
9875    }
9876    if (rf & 2) {
9877      \u0275\u0275advance(3);
9878      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 4, "MESSENGER.TIKTOK.MUSIC_ADD"));
9879      \u0275\u0275advance(3);
9880      \u0275\u0275property("placeholder", \u0275\u0275pipeBind1(7, 6, "GLOBAL.SEARCH"));
9881      \u0275\u0275advance(3);
9882      \u0275\u0275conditional(ctx.selectedTrack() ? 9 : -1);
9883      \u0275\u0275advance();
9884      \u0275\u0275conditional(!ctx.isLoading() && ctx.tracks().length > 0 ? 10 : 11);
9885    }
9886  }, dependencies: [
9887    TranslatePipe,
9888    ButtonComponent,
9889    EmptyListComponent,
9890    InputSearchComponent,
9891    MusicSelectedTrackComponent,
9892    MusicTrackItemComponent
9893  ], encapsulation: 2 });
9894};
9895(() => {
9896  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MusicSearchComponent, [{
9897    type: Component,
9898    args: [{ selector: "app-music-search", imports: [
9899      TranslatePipe,
9900      ButtonComponent,
9901      EmptyListComponent,
9902      InputSearchComponent,
9903      MusicSelectedTrackComponent,
9904      MusicTrackItemComponent
9905    ], providers: [MusicPlayerService], template: `<article class="w-[28rem] h-[33rem] flex flex-col gap-4 p-5 pb-2">
9906  <header class="flex items-center justify-between">
9907    <h2 class="text-base font-semibold">{{ 'MESSENGER.TIKTOK.MUSIC_ADD' | translate }}</h2>
9908  </header>
9909
9910  <div class="flex items-center gap-3">
9911    <ui-input-search
9912      (valueChange)="searchQuery.set($event)"
9913      [placeholder]="'GLOBAL.SEARCH' | translate"
9914      size="small"
9915      class="w-full"
9916    />
9917    <ui-button (click)="goToFilter.emit()" icon="listFilter" severity="contrast" styleClass="size-9! aspect-square" />
9918  </div>
9919
9920  @if (selectedTrack()) {
9921  <app-music-selected-track (edit)="goToEdit.emit()" (remove)="trackSelected.emit(null)" [track]="selectedTrack()!" />
9922  } @if (!isLoading() && tracks().length > 0) {
9923  <ul class="flex-1 overflow-y-auto">
9924    @for (t of tracks().items; track t.id) {
9925    <app-music-track-item (select)="trackSelected.emit(t)" [track]="t" [selected]="selectedTrack()?.id === t.id" />
9926    }
9927  </ul>
9928  } @else {
9929  <div class="flex-1">
9930    <ui-empty-list
9931      [hasItems]="true"
9932      [noResultsLabel]="'GLOBAL.EMPTY.NO_RESULTS_LIST_TITLE'"
9933      [noResultsDescription]="'GLOBAL.EMPTY.NO_RESULTS_LIST_DESC'"
9934      [isScreenView]="false"
9935      [isLoading]="isLoading()"
9936      [width]="'100%'"
9937      [height]="'100%'"
9938      emptyTitleStyleClass="text-md! px-0!"
9939      emptyDescriptionStyleClass="text-sm! px-0!"
9940      emptyStyleClass="gap-2! mt-20!"
9941      iconStyleClass="size-16!"
9942    />
9943  </div>
9944  }
9945</article>
9946` }]
9947  }], () => [], null);
9948})();
9949(() => {
9950  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(MusicSearchComponent, { className: "MusicSearchComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/components/music-dialog/components/music-search/music-search.component.ts", lineNumber: 24 });
9951})();
9952
9953// libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/entities/music.entity.ts
9954var TIKTOK_GENRES = [
9955  { value: "ROCK", label: "Rock" },
9956  { value: "POP", label: "Pop" },
9957  { value: "LATIN", label: "Latin" },
9958  { value: "METAL", label: "Metal" },
9959  { value: "ELECTRONIC", label: "Electronic" },
9960  { value: "HIP_HOP/RAP", label: "Hip Hop/Rap" },
9961  { value: "ALTERNATIVE/INDIE", label: "Alternative/Indie" },
9962  { value: "FOLK", label: "Folk" },
9963  { value: "R&B/SOUL", label: "R&B/Soul" },
9964  { value: "COUNTRY", label: "Country" },
9965  { value: "CLASSICAL", label: "Classical" },
9966  { value: "JAZZ", label: "Jazz" },
9967  { value: "REGGAE", label: "Reggae" },
9968  { value: "CHILDHOOD", label: "Childhood" },
9969  { value: "BLUES", label: "Blues" },
9970  { value: "EASY_LISTENING", label: "Easy Listening" },
9971  { value: "NEW_AGE", label: "New Age" },
9972  { value: "WORLD_MUSIC", label: "World Music" },
9973  { value: "EXPERIMENTAL", label: "Experimental" },
9974  { value: "DEVOTIONAL", label: "Devotional" },
9975  { value: "CHINESE_TRADITION", label: "Chinese Tradition" },
9976  { value: "8_BIT", label: "8 Bit" },
9977  { value: "A_CAPPELLA", label: "A Cappella" },
9978  { value: "AFRO-POP", label: "Afro-Pop" },
9979  { value: "ALTERNATIVE_HIP_HOP", label: "Alternative Hip Hop" },
9980  { value: "ALTERNATIVE_ROCK", label: "Alternative Rock" },
9981  { value: "AMBIENT", label: "Ambient" },
9982  { value: "ARABIC_POP", label: "Arabic Pop" },
9983  { value: "BASS_HOUSE", label: "Bass House" },
9984  { value: "BGM", label: "BGM" },
9985  { value: "BOOMBAP", label: "Boombap" },
9986  { value: "BOSSA_NOVA", label: "Bossa Nova" },
9987  { value: "BRAZILIAN_FUNK_STYLE", label: "Brazilian Funk Style" },
9988  { value: "BUDDHIST_MUSIC", label: "Buddhist Music" },
9989  { value: "CANTOPOP", label: "Cantopop" },
9990  { value: "CELTIC_POP", label: "Celtic Pop" },
9991  { value: "CHAMBER_MUSIC", label: "Chamber Music" },
9992  { value: "CHILL_BEATS", label: "Chill Beats" },
9993  { value: "CHILLOUT", label: "Chillout" },
9994  { value: "CHINESE_FOLK", label: "Chinese Folk" },
9995  { value: "CHINESE_OPERA", label: "Chinese Opera" },
9996  { value: "CHINESE_POP", label: "Chinese Pop" },
9997  { value: "CHINESE_STYLE", label: "Chinese Style" },
9998  { value: "CHINOISERIE_ELECTRONIC", label: "Chinoiserie Electronic" },
9999  { value: "CHINOISERIE_RAP", label: "Chinoiserie Rap" },
10000  { value: "CHRISTIAN_MUSIC", label: "Christian Music" },
10001  { value: "CONTEMPORARY_R&B", label: "Contemporary R&B" },
10002  { value: "COUNTRY_POP", label: "Country Pop" },
10003  { value: "DANCE_POP", label: "Dance Pop" },
10004  { value: "DISCO", label: "Disco" },
10005  { value: "DJ", label: "DJ" },
10006  { value: "DRUM&BASS", label: "Drum&Bass" },
10007  { value: "DUBSTEP", label: "Dubstep" },
10008  { value: "EDM", label: "EDM" },
10009  { value: "EDM_TRAP", label: "EDM Trap" },
10010  { value: "ELECTRO_POP", label: "Electro Pop" },
10011  { value: "EPIC", label: "Epic" },
10012  { value: "FOLK_POP", label: "Folk Pop" },
10013  { value: "FUNK", label: "Funk" },
10014  { value: "FUTURE_BASS", label: "Future Bass" },
10015  { value: "GOSPEL", label: "Gospel" },
10016  { value: "GUFENG_MUSIC", label: "Gufeng Music" },
10017  { value: "HARD_ROCK", label: "Hard Rock" },
10018  { value: "HIP_HOUSE", label: "Hip House" },
10019  { value: "HOLIDAY_MUSIC", label: "Holiday Music" },
10020  { value: "HOUSE", label: "House" },
10021  { value: "INDIAN_POP", label: "Indian Pop" },
10022  { value: "INDIE_FOLK", label: "Indie Folk" },
10023  { value: "INDIE_POP", label: "Indie Pop" },
10024  { value: "INDIE_ROCK", label: "Indie Rock" },
10025  { value: "INSTRUMENTAL_HIP_HOP", label: "Instrumental Hip Hop" },
10026  { value: "INSTRUMENTAL_ROCK", label: "Instrumental Rock" },
10027  { value: "IRISH_FOLK", label: "Irish Folk" },
10028  { value: "J_ROCK", label: "J-Rock" },
10029  { value: "JAPANESE_TRADITIONAL_MUSIC", label: "Japanese Traditional Music" },
10030  { value: "JAZZ_FUSION", label: "Jazz Fusion" },
10031  { value: "JAZZ_HIP_HOP", label: "Jazz Hip Hop" },
10032  { value: "JAZZ_POP", label: "Jazz Pop" },
10033  { value: "J-POP", label: "J-Pop" },
10034  { value: "K-POP", label: "K-Pop" },
10035  { value: "LATIN_POP", label: "Latin Pop" },
10036  { value: "LO-FI", label: "Lo-fi" },
10037  { value: "MC", label: "MC" },
10038  { value: "NOISE", label: "Noise" },
10039  { value: "OLD_SCHOOL", label: "Old School" },
10040  { value: "OTHERS", label: "Others" },
10041  { value: "POP_RAP", label: "Pop Rap" },
10042  { value: "POP_ROCK", label: "Pop Rock" },
10043  { value: "POP_SOUL", label: "Pop Soul" },
10044  { value: "PSYCHEDELIC_ROCK", label: "Psychedelic Rock" },
10045  { value: "PUNK", label: "Punk" },
10046  { value: "R&B_RAP", label: "R&B/Rap" },
10047  { value: "REGGAETON", label: "Reggaeton" },
10048  { value: "RUSSIAN_POP", label: "Russian Pop" },
10049  { value: "SERTANEJO", label: "Sertanejo" },
10050  { value: "SON_CUBANO", label: "Son Cubano" },
10051  { value: "SOUL", label: "Soul" },
10052  { value: "SOUNDTRACK", label: "Soundtrack" },
10053  { value: "SYMPHONY", label: "Symphony" },
10054  { value: "SYNTH_POP", label: "Synth Pop" },
10055  { value: "TANGO", label: "Tango" },
10056  { value: "TECHNO", label: "Techno" },
10057  { value: "TEEN_POP", label: "Teen Pop" },
10058  { value: "TRADITIONAL_CHINESE_FOLK", label: "Traditional Chinese Folk" },
10059  { value: "TRANCE", label: "Trance" },
10060  { value: "TRAP_RAP", label: "Trap Rap" },
10061  { value: "TRIP_HOP", label: "Trip Hop" },
10062  { value: "TROPICAL_HOUSE", label: "Tropical House" },
10063  { value: "TURKISH_POP", label: "Turkish Pop" }
10064];
10065
10066// libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/components/music-dialog/components/music-filter/music-filter.component.ts
10067function MusicFilterComponent_ng_template_12_Template(rf, ctx) {
10068  if (rf & 1) {
10069    \u0275\u0275elementStart(0, "span");
10070    \u0275\u0275text(1);
10071    \u0275\u0275elementEnd();
10072  }
10073  if (rf & 2) {
10074    const item_r1 = ctx.$implicit;
10075    \u0275\u0275advance();
10076    \u0275\u0275textInterpolate(item_r1.label);
10077  }
10078}
10079function MusicFilterComponent_ng_template_13_Template(rf, ctx) {
10080  if (rf & 1) {
10081    \u0275\u0275elementStart(0, "span");
10082    \u0275\u0275text(1);
10083    \u0275\u0275elementEnd();
10084  }
10085  if (rf & 2) {
10086    const item_r2 = ctx.$implicit;
10087    \u0275\u0275advance();
10088    \u0275\u0275textInterpolate(item_r2.label);
10089  }
10090}
10091function MusicFilterComponent_ng_template_20_Template(rf, ctx) {
10092  if (rf & 1) {
10093    \u0275\u0275elementStart(0, "span");
10094    \u0275\u0275text(1);
10095    \u0275\u0275elementEnd();
10096  }
10097  if (rf & 2) {
10098    const item_r3 = ctx.$implicit;
10099    \u0275\u0275advance();
10100    \u0275\u0275textInterpolate(item_r3.label);
10101  }
10102}
10103function MusicFilterComponent_ng_template_21_Template(rf, ctx) {
10104  if (rf & 1) {
10105    \u0275\u0275elementStart(0, "span");
10106    \u0275\u0275text(1);
10107    \u0275\u0275elementEnd();
10108  }
10109  if (rf & 2) {
10110    const item_r4 = ctx.$implicit;
10111    \u0275\u0275advance();
10112    \u0275\u0275textInterpolate(item_r4.label);
10113  }
10114}
10115var MusicFilterComponent = class _MusicFilterComponent {
10116  genre = input("");
10117  countryCode = input("");
10118  cancel = output();
10119  apply = output();
10120  selectedGenre = "";
10121  selectedCountry = "";
10122  countries = countries;
10123  genres = TIKTOK_GENRES;
10124  constructor() {
10125    effect(() => {
10126      this.selectedGenre = this.genre();
10127      this.selectedCountry = this.countryCode();
10128    });
10129  }
10130  static \u0275fac = function MusicFilterComponent_Factory(__ngFactoryType__) {
10131    return new (__ngFactoryType__ || _MusicFilterComponent)();
10132  };
10133  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _MusicFilterComponent, selectors: [["app-music-filter"]], inputs: { genre: [1, "genre"], countryCode: [1, "countryCode"] }, outputs: { cancel: "cancel", apply: "apply" }, decls: 25, vars: 21, consts: [[1, "w-[28rem]", "h-[33rem]", "flex", "flex-col", "gap-4", "p-5"], [1, "flex", "items-center", "justify-between"], [1, "text-base", "font-semibold"], [1, "flex-1", "flex", "flex-col", "gap-5"], [1, "flex", "flex-col"], [1, "label"], ["optionLabel", "label", "optionValue", "value", 3, "ngModelChange", "ngModel", "options", "filter", "placeholder"], ["selectSelectedItem", ""], ["selectItem", ""], [1, "flex", "items-center", "gap-5", "pb-1"], ["label", "GLOBAL.CANCEL", "severity", "contrast", 1, "w-full", 3, "click"], ["label", "GLOBAL.APPLY", 1, "w-full", 3, "click"]], template: function MusicFilterComponent_Template(rf, ctx) {
10134    if (rf & 1) {
10135      \u0275\u0275elementStart(0, "article", 0)(1, "header", 1)(2, "h2", 2);
10136      \u0275\u0275text(3);
10137      \u0275\u0275pipe(4, "translate");
10138      \u0275\u0275elementEnd()();
10139      \u0275\u0275elementStart(5, "div", 3)(6, "div", 4)(7, "span", 5);
10140      \u0275\u0275text(8);
10141      \u0275\u0275pipe(9, "translate");
10142      \u0275\u0275elementEnd();
10143      \u0275\u0275elementStart(10, "ui-select", 6);
10144      \u0275\u0275pipe(11, "translate");
10145      \u0275\u0275twoWayListener("ngModelChange", function MusicFilterComponent_Template_ui_select_ngModelChange_10_listener($event) {
10146        \u0275\u0275twoWayBindingSet(ctx.selectedCountry, $event) || (ctx.selectedCountry = $event);
10147        return $event;
10148      });
10149      \u0275\u0275template(12, MusicFilterComponent_ng_template_12_Template, 2, 1, "ng-template", 7)(13, MusicFilterComponent_ng_template_13_Template, 2, 1, "ng-template", 8);
10150      \u0275\u0275elementEnd()();
10151      \u0275\u0275elementStart(14, "div", 4)(15, "span", 5);
10152      \u0275\u0275text(16);
10153      \u0275\u0275pipe(17, "translate");
10154      \u0275\u0275elementEnd();
10155      \u0275\u0275elementStart(18, "ui-select", 6);
10156      \u0275\u0275pipe(19, "translate");
10157      \u0275\u0275twoWayListener("ngModelChange", function MusicFilterComponent_Template_ui_select_ngModelChange_18_listener($event) {
10158        \u0275\u0275twoWayBindingSet(ctx.selectedGenre, $event) || (ctx.selectedGenre = $event);
10159        return $event;
10160      });
10161      \u0275\u0275template(20, MusicFilterComponent_ng_template_20_Template, 2, 1, "ng-template", 7)(21, MusicFilterComponent_ng_template_21_Template, 2, 1, "ng-template", 8);
10162      \u0275\u0275elementEnd()()();
10163      \u0275\u0275elementStart(22, "footer", 9)(23, "ui-button", 10);
10164      \u0275\u0275listener("click", function MusicFilterComponent_Template_ui_button_click_23_listener() {
10165        return ctx.cancel.emit();
10166      });
10167      \u0275\u0275elementEnd();
10168      \u0275\u0275elementStart(24, "ui-button", 11);
10169      \u0275\u0275listener("click", function MusicFilterComponent_Template_ui_button_click_24_listener() {
10170        return ctx.apply.emit({ genre: ctx.selectedGenre, countryCode: ctx.selectedCountry });
10171      });
10172      \u0275\u0275elementEnd()()();
10173    }
10174    if (rf & 2) {
10175      \u0275\u0275advance(3);
10176      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 11, "MESSENGER.TIKTOK.MUSIC_FILTER"));
10177      \u0275\u0275advance(5);
10178      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(9, 13, "MESSENGER.TIKTOK.MUSIC_BY_COUNTRY"));
10179      \u0275\u0275advance(2);
10180      \u0275\u0275twoWayProperty("ngModel", ctx.selectedCountry);
10181      \u0275\u0275property("options", ctx.countries)("filter", true)("placeholder", \u0275\u0275pipeBind1(11, 15, "G
10181LOBAL.SELECT"));
10182      \u0275\u0275advance(6);
10183      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(17, 17, "MESSENGER.TIKTOK.MUSIC_BY_GENRE"));
10184      \u0275\u0275advance(2);
10185      \u0275\u0275twoWayProperty("ngModel", ctx.selectedGenre);
10186      \u0275\u0275property("options", ctx.genres)("filter", true)("placeholder", \u0275\u0275pipeBind1(19, 19, "GLOBAL.SELECT"));
10187    }
10188  }, dependencies: [
10189    FormsModule,
10190    NgControlStatus,
10191    NgModel,
10192    TranslatePipe,
10193    ButtonComponent,
10194    SelectComponent,
10195    SelectSelectedItemDirective,
10196    SelectItemDirective
10197  ], encapsulation: 2 });
10198};
10199(() => {
10200  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MusicFilterComponent, [{
10201    type: Component,
10202    args: [{ selector: "app-music-filter", imports: [
10203      FormsModule,
10204      TranslatePipe,
10205      ButtonComponent,
10206      SelectComponent,
10207      SelectSelectedItemDirective,
10208      SelectItemDirective
10209    ], template: `<article class="w-[28rem] h-[33rem] flex flex-col gap-4 p-5">
10210  <header class="flex items-center justify-between">
10211    <h2 class="text-base font-semibold">{{ 'MESSENGER.TIKTOK.MUSIC_FILTER' | translate }}</h2>
10212  </header>
10213
10214  <div class="flex-1 flex flex-col gap-5">
10215    <div class="flex flex-col">
10216      <span class="label">{{ 'MESSENGER.TIKTOK.MUSIC_BY_COUNTRY' | translate }}</span>
10217      <ui-select
10218        [(ngModel)]="selectedCountry"
10219        [options]="countries"
10220        [filter]="true"
10221        [placeholder]="'GLOBAL.SELECT' | translate"
10222        optionLabel="label"
10223        optionValue="value"
10224      >
10225        <ng-template selectSelectedItem let-item>
10226          <span>{{ item.label }}</span>
10227        </ng-template>
10228        <ng-template selectItem let-item>
10229          <span>{{ item.label }}</span>
10230        </ng-template>
10231      </ui-select>
10232    </div>
10233
10234    <div class="flex flex-col">
10235      <span class="label">{{ 'MESSENGER.TIKTOK.MUSIC_BY_GENRE' | translate }}</span>
10236      <ui-select
10237        [(ngModel)]="selectedGenre"
10238        [options]="genres"
10239        [filter]="true"
10240        [placeholder]="'GLOBAL.SELECT' | translate"
10241        optionLabel="label"
10242        optionValue="value"
10243      >
10244        <ng-template selectSelectedItem let-item>
10245          <span>{{ item.label }}</span>
10246        </ng-template>
10247        <ng-template selectItem let-item>
10248          <span>{{ item.label }}</span>
10249        </ng-template>
10250      </ui-select>
10251    </div>
10252  </div>
10253
10254  <footer class="flex items-center gap-5 pb-1">
10255    <ui-button (click)="cancel.emit()" label="GLOBAL.CANCEL" severity="contrast" class="w-full" />
10256    <ui-button
10257      (click)="apply.emit({ genre: selectedGenre, countryCode: selectedCountry })"
10258      label="GLOBAL.APPLY"
10259      class="w-full"
10260    />
10261  </footer>
10262</article>
10263` }]
10264  }], () => [], null);
10265})();
10266(() => {
10267  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(MusicFilterComponent, { className: "MusicFilterComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/components/music-dialog/components/music-filter/music-filter.component.ts", lineNumber: 19 });
10268})();
10269
10270// libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/components/music-dialog/components/music-edit/components/music-clip-toggle/music-clip-toggle.component.ts
10271var MusicClipToggleComponent = class _MusicClipToggleComponent {
10272  mode = input.required();
10273  modeChange = output();
10274  static \u0275fac = function MusicClipToggleComponent_Factory(__ngFactoryType__) {
10275    return new (__ngFactoryType__ || _MusicClipToggleComponent)();
10276  };
10277  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _MusicClipToggleComponent, selectors: [["app-music-clip-toggle"]], inputs: { mode: [1, "mode"] }, outputs: { modeChange: "modeChange" }, decls: 7, vars: 22, consts: [[1, "flex", "items-center", "gap-1", "bg-white-700", "rounded-lg", "p-2", "mb-2"], [1, "flex-1", "text-sm", "font-medium", "px-3", "py-1.5", "rounded-md", "cursor-pointer", 3, "click"]], template: function MusicClipToggleComponent_Template(rf, ctx) {
10278    if (rf & 1) {
10279      \u0275\u0275elementStart(0, "div", 0)(1, "button", 1);
10280      \u0275\u0275listener("click", function MusicClipToggleComponent_Template_button_click_1_listener() {
10281        return ctx.modeChange.emit("trending");
10282      });
10283      \u0275\u0275text(2);
10284      \u0275\u0275pipe(3, "translate");
10285      \u0275\u0275elementEnd();
10286      \u0275\u0275elementStart(4, "button", 1);
10287      \u0275\u0275listener("click", function MusicClipToggleComponent_Template_button_click_4_listener() {
10288        return ctx.modeChange.emit("full");
10289      });
10290      \u0275\u0275text(5);
10291      \u0275\u0275pipe(6, "translate");
10292      \u0275\u0275elementEnd()();
10293    }
10294    if (rf & 2) {
10295      \u0275\u0275advance();
10296      \u0275\u0275classProp("bg-white", ctx.mode() === "trending")("font-semibold", ctx.mode() === "trending")("text-grey-800", ctx.mode() === "trending")("text-grey-300", ctx.mode() !== "trending");
10297      \u0275\u0275advance();
10298      \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(3, 18, "MESSENGER.TIKTOK.MUSIC_CLIP_TRENDING"), " ");
10299      \u0275\u0275advance(2);
10300      \u0275\u0275classProp("bg-white", ctx.mode() === "full")("font-semibold", ctx.mode() === "full")("text-grey-800", ctx.mode() === "full")("text-grey-300", ctx.mode() !== "full");
10301      \u0275\u0275advance();
10302      \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(6, 20, "MESSENGER.TIKTOK.MUSIC_CLIP_FULL"), " ");
10303    }
10304  }, dependencies: [TranslatePipe], encapsulation: 2 });
10305};
10306(() => {
10307  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MusicClipToggleComponent, [{
10308    type: Component,
10309    args: [{ selector: "app-music-clip-toggle", imports: [TranslatePipe], template: `<div class="flex items-center gap-1 bg-white-700 rounded-lg p-2 mb-2">
10310  <button
10311    (click)="modeChange.emit('trending')"
10312    class="flex-1 text-sm font-medium px-3 py-1.5 rounded-md cursor-pointer"
10313    [class.bg-white]="mode() === 'trending'"
10314    [class.font-semibold]="mode() === 'trending'"
10315    [class.text-grey-800]="mode() === 'trending'"
10316    [class.text-grey-300]="mode() !== 'trending'"
10317  >
10318    {{ 'MESSENGER.TIKTOK.MUSIC_CLIP_TRENDING' | translate }}
10319  </button>
10320  <button
10321    (click)="modeChange.emit('full')"
10322    class="flex-1 text-sm font-medium px-3 py-1.5 rounded-md cursor-pointer"
10323    [class.bg-white]="mode() === 'full'"
10324    [class.font-semibold]="mode() === 'full'"
10325    [class.text-grey-800]="mode() === 'full'"
10326    [class.text-grey-300]="mode() !== 'full'"
10327  >
10328    {{ 'MESSENGER.TIKTOK.MUSIC_CLIP_FULL' | translate }}
10329  </button>
10330</div>
10331` }]
10332  }], null, null);
10333})();
10334(() => {
10335  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(MusicClipToggleComponent, { className: "MusicClipToggleComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/components/music-dialog/components/music-edit/components/music-clip-toggle/music-clip-toggle.component.ts", lineNumber: 10 });
10336})();
10337
10338// libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/components/music-dialog/components/music-edit/components/music-slider/music-slider.component.ts
10339var MusicSliderComponent = class _MusicSliderComponent {
10340  value = input.required();
10341  icon = input.required();
10342  label = input.required();
10343  max = input(100);
10344  valueChange = output();
10345  onSliderClick(event) {
10346    const track = event.currentTarget;
10347    const rect = track.getBoundingClientRect();
10348    const percent = Math.max(0, Math.min(1, (event.clientX - rect.left) / rect.width));
10349    this.valueChange.emit(Math.round(percent * this.max()));
10350  }
10351  onThumbDrag(event) {
10352    event.preventDefault();
10353    const track = event.target.parentElement;
10354    const rect = track.getBoundingClientRect();
10355    const onMove = (e) => {
10356      const percent = Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width));
10357      this.valueChange.emit(Math.round(percent * this.max()));
10358    };
10359    const onUp = () => {
10360      document.removeEventListener("mousemove", onMove);
10361      document.removeEventListener("mouseup", onUp);
10362    };
10363    document.addEventListener("mousemove", onMove);
10364    document.addEventListener("mouseup", onUp);
10365  }
10366  adjust(delta) {
10367    this.valueChange.emit(Math.max(0, Math.min(this.max(), this.value() + delta)));
10368  }
10369  static \u0275fac = function MusicSliderComponent_Factory(__ngFactoryType__) {
10370    return new (__ngFactoryType__ || _MusicSliderComponent)();
10371  };
10372  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _MusicSliderComponent, selectors: [["app-music-slider"]], inputs: { value: [1, "value"], icon: [1, "icon"], label: [1, "label"], max: [1, "max"] }, outputs: { valueChange: "valueChange" }, decls: 9, vars: 14, consts: [[1, "flex", "flex-col", "gap-3"], [1, "flex", "items-center", "gap-2"], ["styleClass", "text-grey-500", 3, "name", "size"], [1, "text-sm", "font-medium"], ["role", "slider", "tabindex", "0", 1, "relative", "h-10", "w-full", "rounded-base", "bg-grey-50", "cursor-pointer", "select-none", 3, "click", "keydown.arrowRight", "keydown.arrowLeft"], [1, "absolute", "inset-y-0", "left-0", "rounded-l-base", "bg-secondary-500"], [1, "absolute", "h-[120%]", "-top-1", "w-3", "rounded-full", "bg-white", "shadow-md", "border", "border-grey-50", 3, "mousedown"]], template: function MusicSliderComponent_Template(rf, ctx) {
10373    if (rf & 1) {
10374      \u0275\u0275elementStart(0, "div", 0)(1, "div", 1);
10375      \u0275\u0275element(2, "ui-icon", 2);
10376      \u0275\u0275elementStart(3, "span", 3);
10377      \u0275\u0275text(4);
10378      \u0275\u0275pipe(5, "translate");
10379      \u0275\u0275elementEnd()();
10380      \u0275\u0275elementStart(6, "div", 4);
10381      \u0275\u0275listener("click", function MusicSliderComponent_Template_div_click_6_listener($event) {
10382        return ctx.onSliderClick($event);
10383      })("keydown.arrowRight", function MusicSliderComponent_Template_div_keydown_arrowRight_6_listener() {
10384        return ctx.adjust(1);
10385      })("keydown.arrowLeft", function MusicSliderComponent_Template_div_keydown_arrowLeft_6_listener() {
10386        return ctx.adjust(-1);
10387      });
10388      \u0275\u0275element(7, "div", 5);
10389      \u0275\u0275elementStart(8, "div", 6);
10390      \u0275\u0275listener("mousedown", function MusicSliderComponent_Template_div_mousedown_8_listener($event) {
10391        return ctx.onThumbDrag($event);
10392      });
10393      \u0275\u0275elementEnd()()();
10394    }
10395    if (rf & 2) {
10396      \u0275\u0275advance(2);
10397      \u0275\u0275property("name", ctx.icon())("size", 16);
10398      \u0275\u0275advance(2);
10399      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(5, 12, ctx.label()));
10400      \u0275\u0275advance(2);
10401      \u0275\u0275attribute("aria-valuenow", ctx.value())("aria-valuemin", 0)("aria-valuemax", ctx.max());
10402      \u0275\u0275advance();
10403      \u0275\u0275styleProp("width", ctx.value(), "%");
10404      \u0275\u0275advance();
10405      \u0275\u0275styleProp("left", ctx.value(), "%")("margin-left", -6, "px");
10406    }
10407  }, dependencies: [TranslatePipe, IconComponent], encapsulation: 2 });
10408};
10409(() => {
10410  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MusicSliderComponent, [{
10411    type: Component,
10412    args: [{ selector: "app-music-slider", imports: [TranslatePipe, IconComponent], template: '<div class="flex flex-col gap-3">\n  <div class="flex items-center gap-2">\n    <ui-icon [name]="icon()" [size]="16" styleClass="text-grey-500" />\n    <span class="text-sm font-medium">{{ label() | translate }}</span>\n  </div>\n  <div\n    (click)="onSliderClick($event)"\n    (keydown.arrowRight)="adjust(1)"\n    (keydown.arrowLeft)="adjust(-1)"\n    role="slider"\n    tabindex="0"\n    [attr.aria-valuenow]="value(
10412)"\n    [attr.aria-valuemin]="0"\n    [attr.aria-valuemax]="max()"\n    class="relative h-10 w-full rounded-base bg-grey-50 cursor-pointer select-none"\n  >\n    <div class="absolute inset-y-0 left-0 rounded-l-base bg-secondary-500" [style.width.%]="value()"></div>\n    <div\n      (mousedown)="onThumbDrag($event)"\n      class="absolute h-[120%] -top-1 w-3 rounded-full bg-white shadow-md border border-grey-50"\n      [style.left.%]="value()"\n      [style.margin-left.px]="-6"\n    ></div>\n  </div>\n</div>\n' }]
10413  }], null, null);
10414})();
10415(() => {
10416  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(MusicSliderComponent, { className: "MusicSliderComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/components/music-dialog/components/music-edit/components/music-slider/music-slider.component.ts", lineNumber: 10 });
10417})();
10418
10419// libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/components/music-dialog/components/music-edit/components/music-waveform/music-waveform.component.ts
10420var _c013 = ["waveformContainer"];
10421function MusicWaveformComponent_For_4_Template(rf, ctx) {
10422  if (rf & 1) {
10423    \u0275\u0275element(0, "div");
10424  }
10425  if (rf & 2) {
10426    const bar_r2 = ctx.$implicit;
10427    const $index_r3 = ctx.$index;
10428    const ctx_r3 = \u0275\u0275nextContext();
10429    \u0275\u0275classMap(ctx_r3.getBarClass($index_r3));
10430    \u0275\u0275styleProp("height", bar_r2, "%");
10431  }
10432}
10433var WAVEFORM_PREVIEW_ID = "waveform-preview";
10434var MusicWaveformComponent = class _MusicWaveformComponent {
10435  previewUrl = input.required();
10436  start = input.required();
10437  end = input.required();
10438  maxDuration = input.required();
10439  bars = input(Array.from({ length: 60 }, (_, i) => {
10440    const h1 = i * 127 % 71;
10441    const h2 = i * 53 % 41;
10442    return 12 + h1 + Math.round(h2 * 0.3);
10443  }));
10444  startChange = output();
10445  endChange = output();
10446  container = viewChild.required("waveformContainer");
10447  player = inject(MusicPlayerService);
10448  isPlaying = computed(() => this.player.playingId() === WAVEFORM_PREVIEW_ID);
10449  minGap = 500;
10450  toggle() {
10451    this.player.playSegment(WAVEFORM_PREVIEW_ID, this.previewUrl(), this.start() / 1e3, this.end() / 1e3);
10452  }
10453  getBarIndex(ms) {
10454    return Math.floor(ms / this.maxDuration() * this.bars().length);
10455  }
10456  getBarClass(index) {
10457    const isSelected = index >= this.getBarIndex(this.start()) && index <= this.getBarIndex(this.end());
10458    if (!isSelected)
10459      return "w-1 rounded-full flex-1 bg-secondary-200";
10460    const level = (index * 37 + index * index * 13) % 10;
10461    const color = level < 2 ? "bg-secondary-200" : level < 7 ? "bg-secondary-500" : "bg-secondary-800";
10462    return `w-1 rounded-full flex-1 ${color}`;
10463  }
10464  onHandleDrag(event, handle) {
10465    event.preventDefault();
10466    const rect = this.container().nativeElement.getBoundingClientRect();
10467    const onMove = (e) => {
10468      const percent = Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width));
10469      const ms = Math.round(percent * this.maxDuration());
10470      if (handle === "start") {
10471        this.startChange.emit(Math.max(0, Math.min(ms, this.end() - this.minGap)));
10472      } else {
10473        this.endChange.emit(Math.min(this.maxDuration(), Math.max(ms, this.start() + this.minGap)));
10474      }
10475    };
10476    const onUp = () => {
10477      document.removeEventListener("mousemove", onMove);
10478      document.removeEventListener("mouseup", onUp);
10479    };
10480    document.addEventListener("mousemove", onMove);
10481    document.addEventListener("mouseup", onUp);
10482  }
10483  onRangeDrag(event) {
10484    event.preventDefault();
10485    const rect = this.container().nativeElement.getBoundingClientRect();
10486    const msPerPx = this.maxDuration() / rect.width;
10487    const initialStart = this.start();
10488    const duration = this.end() - this.start();
10489    const initialX = event.clientX;
10490    const onMove = (e) => {
10491      const deltaPx = e.clientX - initialX;
10492      const deltaMs = Math.round(deltaPx * msPerPx);
10493      const newStart = Math.max(0, Math.min(initialStart + deltaMs, this.maxDuration() - duration));
10494      this.startChange.emit(newStart);
10495      this.endChange.emit(newStart + duration);
10496    };
10497    const onUp = () => {
10498      document.removeEventListener("mousemove", onMove);
10499      document.removeEventListener("mouseup", onUp);
10500    };
10501    document.addEventListener("mousemove", onMove);
10502    document.addEventListener("mouseup", onUp);
10503  }
10504  static \u0275fac = function MusicWaveformComponent_Factory(__ngFactoryType__) {
10505    return new (__ngFactoryType__ || _MusicWaveformComponent)();
10506  };
10507  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _MusicWaveformComponent, selectors: [["app-music-waveform"]], viewQuery: function MusicWaveformComponent_Query(rf, ctx) {
10508    if (rf & 1) {
10509      \u0275\u0275viewQuerySignal(ctx.container, _c013, 5);
10510    }
10511    if (rf & 2) {
10512      \u0275\u0275queryAdvance();
10513    }
10514  }, inputs: { previewUrl: [1, "previewUrl"], start: [1, "start"], end: [1, "end"], maxDuration: [1, "maxDuration"], bars: [1, "bars"] }, outputs: { startChange: "startChange", endChange: "endChange" }, features: [\u0275\u0275ProvidersFeature([MusicPlayerService])], decls: 10, vars: 10, consts: [["waveformContainer", ""], [1, "relative", "h-16", "w-full", "rounded-lg", "bg-white-600", "flex", "items-center"], [1, "flex", "items-end", "gap-0.5", "h-12", "w-full", "px-2"], [3, "class", "height"], [1, "absolute", "top-2", "bottom-2", "border-2", "border-grey-700", "cursor-grab", "active:cursor-grabbing", "pointer-events-auto", "rounded-base", 3, "mousedown"], [1, "absolute", "left-1/2", "top-1/2", "-translate-x-1/2", "-translate-y-1/2", "z-20", "bg-white", "rounded-full", "p-1.5", "shadow", "cursor-pointer", "border", "border-grey-100", 3, "click"], ["styleClass", "text-grey-700", 3, "name", "size"], [1, "absolute", "top-4", "ml-[0.1rem]", "h-8", "w-1.5", "bg-grey-700", "rounded-full", "cursor-ew-resize", "z-10", 2, "transform", "translateX(-50%)", 3, "mousedown"], [1, "absolute", "top-4", "-ml-[0.1rem]", "h-8", "w-1.5", "bg-grey-700", "rounded-full", "cursor-ew-resize", "z-10", 2, "transform", "translateX(-50%)", 3, "mousedown"]], template: function MusicWaveformComponent_Template(rf, ctx) {
10515    if (rf & 1) {
10516      const _r1 = \u0275\u0275getCurrentView();
10517      \u0275\u0275elementStart(0, "div", 1, 0)(2, "div", 2);
10518      \u0275\u0275repeaterCreate(3, MusicWaveformComponent_For_4_Template, 1, 4, "div", 3, \u0275\u0275repeaterTrackByIndex);
10519      \u0275\u0275elementEnd();
10520      \u0275\u0275elementStart(5, "div", 4);
10521      \u0275\u0275listener("mousedown", function MusicWaveformComponent_Template_div_mousedown_5_listener($event) {
10522        \u0275\u0275restoreView(_r1);
10523        return \u0275\u0275resetView(ctx.onRangeDrag($event));
10524      });
10525      \u0275\u0275elementEnd();
10526      \u0275\u0275elementStart(6, "button", 5);
10527      \u0275\u0275listener("click", function MusicWaveformComponent_Template_button_click_6_listener() {
10528        \u0275\u0275restoreView(_r1);
10529        return \u0275\u0275resetView(ctx.toggle());
10530      });
10531      \u0275\u0275element(7, "ui-icon", 6);
10532      \u0275\u0275elementEnd();
10533      \u0275\u0275elementStart(8, "div", 7);
10534      \u0275\u0275listener("mousedown", function MusicWaveformComponent_Template_div_mousedown_8_listener($event) {
10535        \u0275\u0275restoreView(_r1);
10536        return \u0275\u0275resetView(ctx.onHandleDrag($event, "start"));
10537      });
10538      \u0275\u0275elementEnd();
10539      \u0275\u0275elementStart(9, "div", 8);
10540      \u0275\u0275listener("mousedown", function MusicWaveformComponent_Template_div_mousedown_9_listener($event) {
10541        \u0275\u0275restoreView(_r1);
10542        return \u0275\u0275resetView(ctx.onHandleDrag($event, "end"));
10543      });
10544      \u0275\u0275elementEnd()();
10545    }
10546    if (rf & 2) {
10547      \u0275\u0275advance(3);
10548      \u0275\u0275repeater(ctx.bars());
10549      \u0275\u0275advance(2);
10550      \u0275\u0275styleProp("left", ctx.start() / ctx.maxDuration() * 100, "%")("width", (ctx.end() - ctx.start()) / ctx.maxDuration() * 100, "%");
10551      \u0275\u0275advance(2);
10552      \u0275\u0275property("name", ctx.isPlaying() ? "pause" : "play")("size", 13);
10553      \u0275\u0275advance();
10554      \u0275\u0275styleProp("left", ctx.start() / ctx.maxDuration() * 100, "%");
10555      \u0275\u0275advance();
10556      \u0275\u0275styleProp("left", ctx.end() / ctx.maxDuration() * 100, "%");
10557    }
10558  }, dependencies: [IconComponent], encapsulation: 2 });
10559};
10560(() => {
10561  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MusicWaveformComponent, [{
10562    type: Component,
10563    args: [{ selector: "app-music-waveform", imports: [IconComponent], providers: [MusicPlayerService], template: `<div #waveformContainer class="relative h-16 w-full rounded-lg bg-white-600 flex items-center">
10564  <div class="flex items-end gap-0.5 h-12 w-full px-2">
10565    @for (bar of bars(); track $index) {
10566    <div [class]="getBarClass($index)" [style.height.%]="bar"></div>
10567    }
10568  </div>
10569
10570  <!-- Thin top/bottom border connecting the two pillars -->
10571  <div
10572    (mousedown)="onRangeDrag($event)"
10573    class="absolute top-2 bottom-2 border-2 border-grey-700 cursor-grab active:cursor-grabbing pointer-events-auto rounded-base"
10574    [style.left.%]="(start() / maxDuration()) * 100"
10575    [style.width.%]="((end() - start()) / maxDuration()) * 100"
10576  ></div>
10577
10578  <!-- Play/pause button -->
10579  <button
10580    (click)="toggle()"
10581    class="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 z-20 bg-white rounded-full p-1.5 shadow cursor-pointer border border-grey-100"
10582  >
10583    <ui-icon [name]="isPlaying() ? 'pause' : 'play'" [size]="13" styleClass="text-grey-700" />
10584  </button>
10585
10586  <!-- Left pillar -->
10587  <div
10588    (mousedown)="onHandleDrag($event, 'start')"
10589    class="absolute top-4 ml-[0.1rem] h-8 w-1.5 bg-grey-700 rounded-full cursor-ew-resize z-10"
10590    [style.left.%]="(start() / maxDuration()) * 100"
10591    style="transform: translateX(-50%)"
10592  ></div>
10593
10594  <!-- Right pillar -->
10595  <div
10596    (mousedown)="onHandleDrag($event, 'end')"
10597    class="absolute top-4 -ml-[0.1rem] h-8 w-1.5 bg-grey-700 rounded-full cursor-ew-resize z-10"
10598    [style.left.%]="(end() / maxDuration()) * 100"
10599    style="transform: translateX(-50%)"
10600  ></div>
10601</div>
10602` }]
10603  }], null, null);
10604})();
10605(() => {
10606  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(MusicWaveformComponent, { className: "MusicWaveformComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/components/music-dialog/components/music-edit/components/music-waveform/music-waveform.component.ts", lineNumber: 13 });
10607})();
10608
10609// libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/components/music-dialog/components/music-edit/music-edit.component.ts
10610var MusicEditComponent = class _MusicEditComponent {
10611  music = input.required();
10612  track = input.required();
10613  cancel = output();
10614  apply = output();
10615  clipMode = signal("trending");
10616  originalVolume = signal(100);
10617  volume = signal(50);
10618  start = signal(0);
10619  end = signal(0);
10620  maxDuration = computed(() => this.track().withMode(this.clipMode()).activeDuration * 1e3);
10621  constructor() {
10622    effect(() => {
10623      const music = this.music();
10624      const track = this.track();
10625      this.clipMode.set(music.id === track.full.id ? "full" : "trending");
10626      this.originalVolume.set(music.originalVolume);
10627      this.volume.set(music.volume);
10628      this.start.set(music.start);
10629      this.end.set(music.end || track.activeDuration * 1e3);
10630    });
10631  }
10632  setClipMode(mode) {
10633    if (this.clipMode() === mode)
10634      return;
10635    this.clipMode.set(mode);
10636    this.start.set(0);
10637    this.end.set(this.track().withMode(mode).activeDuration * 1e3);
10638  }
10639  emitApply() {
10640    this.apply.emit({
10641      id: this.track().withMode(this.clipMode()).activeId,
10642      originalVolume: this.originalVolume(),
10643      volume: this.volume(),
10644      start: this.start(),
10645      end: this.end(),
10646      track: this.track().toPrimitives()
10647    });
10648  }
10649  static \u0275fac = function MusicEditComponent_Factory(__ngFactoryType__) {
10650    return new (__ngFactoryType__ || _MusicEditComponent)();
10651  };
10652  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _MusicEditComponent, selectors: [["app-music-edit"]], inputs: { music: [1, "music"], track: [1, "track"] }, outputs: { cancel: "cancel", apply: "apply" }, decls: 29, vars: 32, consts: [[1, "w-[28rem]", "h-[33rem]", "flex", "flex-col", "gap-4", "p-5"], [1, "text-base", "font-semibold"], [1, "flex-1", "flex", "flex-col", "gap-6"], ["icon", "mic", "label", "MESSENGER.TIKTOK.MUSIC_ORIGINAL_SOUND", 3, "valueChange", "value"], ["icon", "music", "label", "MESSENGER.TIKTOK.MUSIC_SOUND", 3, "valueChange", "value"], [1, "border-grey-50"], [1, "flex", "flex-col"], [3, "modeChange", "mode"], [1, "flex", "items-center", "justify-between", "mt-3", "mb-1"], [1, "flex", "items-center", "gap-2"], ["name", "scissors", "styleClass", "text-grey-500", 3, "size"], [1, "font-display", "font-semibold"], [1, "text-sm", "text-grey-300", "font-display", "font-semibold"], [3, "startChange", "endChange", "start", "end", "maxDuration", "previewUrl"], [1, "flex", "items-center", "justify-end", "gap-5", "pb-1"], ["severity", "contrast", 1, "w-full", 3, "click", "label"], [1, "w-full", 3, "click", "label"]], template: function MusicEditComponent_Template(rf, ctx) {
10653    if (rf & 1) {
10654      \u0275\u0275elementStart(0, "article", 0)(1, "header")(2, "h2", 1);
10655      \u0275\u0275text(3);
10656      \u0275\u0275pipe(4, "translate");
10657      \u0275\u0275elementEnd()();
10658      \u0275\u0275elementStart(5, "div", 2)(6, "app-music-slider", 3);
10659      \u0275\u0275listener("valueChange", function MusicEditComponent_Template_app_music_slider_valueChange_6_listener($event) {
10660        return ctx.originalVolume.set($event);
10661      });
10662      \u0275\u0275elementEnd();
10663      \u0275\u0275elementStart(7, "app-music-slider", 4);
10664      \u0275\u0275listener("valueChange", function MusicEditComponent_Template_app_music_slider_valueChange_7_listener($event) {
10665        return ctx.volume.set($event);
10666      });
10667      \u0275\u0275elementEnd();
10668      \u0275\u0275element(8, "hr", 5);
10669      \u0275\u0275elementStart(9, "div", 6)(10, "app-music-clip-toggle", 7);
10670      \u0275\u0275listener("modeChange", function MusicEditComponent_Template_app_music_clip_toggle_modeChange_10_listener($event) {
10671        return ctx.setClipMode($event);
10672      });
10673      \u0275\u0275elementEnd();
10674      \u0275\u0275elementStart(11, "div", 8)(12, "div", 9);
10675      \u0275\u0275element(13, "ui-icon", 10);
10676      \u0275\u0275elementStart(14, "span", 11);
10677      \u0275\u0275text(15);
10678      \u0275\u0275pipe(16, "translate");
10679      \u0275\u0275elementEnd()();
10680      \u0275\u0275elementStart(17, "span", 12);
10681      \u0275\u0275text(18);
10682      \u0275\u0275pipe(19, "translate");
10683      \u0275\u0275pipe(20, "formatMs");
10684      \u0275\u0275pipe(21, "translate");
10685      \u0275\u0275pipe(22, "formatMs");
10686      \u0275\u0275elementEnd()();
10687      \u0275\u0275elementStart(23, "app-music-waveform", 13);
10688      \u0275\u0275listener("startChange", function MusicEditComponent_Template_app_music_waveform_startChange_23_listener($event) {
10689        return ctx.start.set($event);
10690      })("endChange", function MusicEditComponent_Template_app_music_waveform_endChange_23_listener($event) {
10691        return ctx.end.set($event);
10692      });
10693      \u0275\u0275elementEnd()()();
10694      \u0275\u0275elementStart(24, "footer", 14)(25, "ui-button", 15);
10695      \u0275\u0275pipe(26, "translate");
10696      \u0275\u0275listener("click", function MusicEditComponent_Template_ui_button_click_25_listener() {
10697        return ctx.cancel.emit();
10698      });
10699      \u0275\u0275elementEnd();
10700      \u0275\u0275elementStart(27, "ui-button", 16);
10701      \u0275\u0275pipe(28, "translate");
10702      \u0275\u0275listener("click", function MusicEditComponent_Template_ui_button_click_27_listener() {
10703        return ctx.emitApply();
10704      });
10705      \u0275\u0275elementEnd()()();
10706    }
10707    if (rf & 2) {
10708      \u0275\u0275advance(3);
10709      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 16, "MESSENGER.TIKTOK.MUSIC_EDIT_AUDIO"));
10710      \u0275\u0275advance(3);
10711      \u0275\u0275property("value", ctx.originalVolume());
10712      \u0275\u0275advance();
10713      \u0275\u0275property("value", ctx.volume());
10714      \u0275\u0275advance(3);
10715      \u0275\u0275property("mode", ctx.clipMode());
10716      \u0275\u0275advance(3);
10717      \u0275\u0275property("size", 16);
10718      \u0275\u0275advance(2);
10719      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(16, 18, "MESSENGER.TIKTOK.MUSIC_DURATION"));
10720      \u0275\u0275advance(3);
10721      \u0275\u0275textInterpolate4(" ", \u0275\u0275pipeBind1(19, 20, "GLOBAL.FROM"), " ", \u0275\u0275pipeBind1(20, 22, ctx.start()), " ", \u0275\u0275pipeBind1(21, 24, "GLOBAL.TO"), " ", \u0275\u0275pipeBind1(22, 26, ctx.end()), " ");
10722      \u0275\u0275advance(5);
10723      \u0275\u0275property("start", ctx.start())("end", ctx.end())("maxDuration", ctx.maxDuration())("previewUrl", ctx.track().activePreviewUrl);
10724      \u0275\u0275advance(2);
10725      \u0275\u0275property("label", \u0275\u0275pipeBind1(26, 28, "GLOBAL.CANCEL"));
10726      \u0275\u0275advance(2);
10727      \u0275\u0275property("label", \u0275\u0275pipeBind1(28, 30, "GLOBAL.APPLY"));
10728    }
10729  }, dependencies: [
10730    TranslatePipe,
10731    FormatMsPipe,
10732    ButtonComponent,
10733    IconComponent,
10734    MusicClipToggleComponent,
10735    MusicSliderComponent,
10736    MusicWaveformComponent
10737  ], encapsulation: 2 });
10738};
10739(() => {
10740  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MusicEditComponent, [{
10741    type: Component,
10742    args: [{ selector: "app-music-edit", imports: [
10743      TranslatePipe,
10744      FormatMsPipe,
10745      ButtonComponent,
10746      IconComponent,
10747      MusicClipToggleComponent,
10748      MusicSliderComponent,
10749      MusicWaveformComponent
10750    ], template: `<article class="w-[28rem] h-[33rem] flex flex-col gap-4 p-5">
10751  <header>
10752    <h2 class="text-base font-semibold">{{ 'MESSENGER.TIKTOK.MUSIC_EDIT_AUDIO' | translate }}</h2>
10753  </header>
10754
10755  <div class="flex-1 flex flex-col gap-6">
10756    <app-music-slider
10757      (valueChange)="originalVolume.set($event)"
10758      [value]="originalVolume()"
10759      icon="mic"
10760      label="MESSENGER.TIKTOK.MUSIC_ORIGINAL_SOUND"
10761    />
10762
10763    <app-music-slider
10764      (valueChange)="volume.set($event)"
10765      [value]="volume()"
10766      icon="music"
10767      label="MESSENGER.TIKTOK.MUSIC_SOUND"
10768    />
10769
10770    <hr class="border-grey-50" />
10771
10772    <div class="flex flex-col">
10773      <app-music-clip-toggle (modeChange)="setClipMode($event)" [mode]="clipMode()" />
10774
10775      <div class="flex items-center justify-between mt-3 mb-1">
10776        <div class="flex items-center gap-2">
10777          <ui-icon name="scissors" [size]="16" styleClass="text-grey-500" />
10778          <span class="font-display font-semibold">{{ 'MESSENGER.TIKTOK.MUSIC_DURATION' | translate }}</span>
10779        </div>
10780        <span class="text-sm text-grey-300 font-display font-semibold">
10781          {{ 'GLOBAL.FROM' | translate }} {{ start() | formatMs }} {{ 'GLOBAL.TO' | translate }} {{ end() | formatMs }}
10782        </span>
10783      </div>
10784
10785      <app-music-waveform
10786        (startChange)="start.set($event)"
10787        (endChange)="end.set($event)"
10788        [start]="start()"
10789        [end]="end()"
10790        [maxDuration]="maxDuration()"
10791        [previewUrl]="track().activePreviewUrl"
10792      />
10793    </div>
10794  </div>
10795
10796  <footer class="flex items-center justify-end gap-5 pb-1">
10797    <ui-button (click)="cancel.emit()" [label]="'GLOBAL.CANCEL' | translate" severity="contrast" class="w-full" />
10798    <ui-button (click)="emitApply()" [label]="'GLOBAL.APPLY' | translate" class="w-full" />
10799  </footer>
10800</article>
10801` }]
10802  }], () => [], null);
10803})();
10804(() => {
10805  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(MusicEditComponent, { className: "MusicEditComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/components/music-dialog/components/music-edit/music-edit.component.ts", lineNumber: 20 });
10806})();
10807
10808// libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/components/music-dialog/music-dialog.component.ts
10809function MusicDialogComponent_Conditional_1_Template(rf, ctx) {
10810  if (rf & 1) {
10811    const _r1 = \u0275\u0275getCurrentView();
10812    \u0275\u0275elementStart(0, "app-music-filter", 3);
10813    \u0275\u0275listener("apply", function MusicDialogComponent_Conditional_1_Template_app_music_filter_apply_0_listener($event) {
10814      \u0275\u0275restoreView(_r1);
10815      const ctx_r1 = \u0275\u0275nextContext();
10816      ctx_r1.filterGenre = $event.genre;
10817      ctx_r1.filterCountry = $event.countryCode;
10818      return \u0275\u0275resetView(ctx_r1.view.set("search"));
10819    })("cancel", function MusicDialogComponent_Conditional_1_Template_app_music_filter_cancel_0_listener() {
10820      \u0275\u0275restoreView(_r1);
10821      const ctx_r1 = \u0275\u0275nextContext();
10822      return \u0275\u0275resetView(ctx_r1.view.set("search"));
10823    });
10824    \u0275\u0275elementEnd();
10825  }
10826  if (rf & 2) {
10827    const ctx_r1 = \u0275\u0275nextContext();
10828    \u0275\u0275property("genre", ctx_r1.filterGenre)("countryCode", ctx_r1.filterCountry);
10829  }
10830}
10831function MusicDialogComponent_Conditional_2_Template(rf, ctx) {
10832  if (rf & 1) {
10833    const _r3 = \u0275\u0275getCurrentView();
10834    \u0275\u0275elementStart(0, "app-music-edit", 4);
10835    \u0275\u0275listener("apply", function MusicDialogComponent_Conditional_2_Template_app_music_edit_apply_0_listener($event) {
10836      \u0275\u0275restoreView(_r3);
10837      const ctx_r1 = \u0275\u0275nextContext();
10838      ctx_r1.applyMusicEdit($event);
10839      return \u0275\u0275resetView(ctx_r1.view.set("search"));
10840    })("cancel", function MusicDialogComponent_Conditional_2_Template_app_music_edit_cancel_0_listener() {
10841      \u0275\u0275restoreView(_r3);
10842      const ctx_r1 = \u0275\u0275nextContext();
10843      return \u0275\u0275resetView(ctx_r1.view.set("search"));
10844    });
10845    \u0275\u0275elementEnd();
10846  }
10847  if (rf & 2) {
10848    const ctx_r1 = \u0275\u0275nextContext();
10849    \u0275\u0275property("music", ctx_r1.store.post().options.tiktok.music)("track", ctx_r1.selectedTrack());
10850  }
10851}
10852var MusicDialogComponent = class _MusicDialogComponent {
10853  userList = input.required();
10854  store = inject(MessengerStore);
10855  locationService = inject(LocationService);
10856  view = signal("search");
10857  selectedTrack = signal(null);
10858  filterGenre = "";
10859  filterCountry = "";
10860  ngOnInit() {
10861    this.filterCountry = this.locationService.countryCode;
10862    const track = this.store.post().options.tiktok.music.track;
10863    if (track) {
10864      this.selectedTrack.set(MusicTrack.from(track));
10865    }
10866  }
10867  selectTrack(track) {
10868    this.selectedTrack.set(track);
10869    this.store.post().options.tiktok.upsert.music(track ? { id: track.activeId, end: track.activeDuration * 1e3, track } : Music.empty().toPrimitives());
10870  }
10871  applyMusicEdit(payload) {
10872    this.store.post().options.tiktok.upsert.music(payload);
10873  }
10874  static \u0275fac = function MusicDialogComponent_Factory(__ngFactoryType__) {
10875    return new (__ngFactoryType__ || _MusicDialogComponent)();
10876  };
10877  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _MusicDialogComponent, selectors: [["app-music-dialog"]], inputs: { userList: [1, "userList"] }, decls: 3, vars: 7, consts: [[3, "trackSelected", "goToFilter", "goToEdit", "hidden", "userList", "selectedTrack", "filterGenre", "filterCountry"], [3, "genre", "countryCode"], [3, "music", "track"], [3, "apply", "cancel", "genre", "countryCode"], [3, "apply", "cancel", "music", "track"]], template: function MusicDialogComponent_Template(rf, ctx) {
10878    if (rf & 1) {
10879      \u0275\u0275elementStart(0, "app-music-search", 0);
10880      \u0275\u0275listener("trackSelected", function MusicDialogComponent_Template_app_music_search_trackSelected_0_listener($event) {
10881        return ctx.selectTrack($event);
10882      })("goToFilter", function MusicDialogComponent_Template_app_music_search_goToFilter_0_listener() {
10883        return ctx.view.set("filter");
10884      })("goToEdit", function MusicDialogComponent_Template_app_music_search_goToEdit_0_listener() {
10885        return ctx.view.set("edit");
10886      });
10887      \u0275\u0275elementEnd();
10888      \u0275\u0275conditionalCreate(1, MusicDialogComponent_Conditional_1_Template, 1, 2, "app-music-filter", 1);
10889      \u0275\u0275conditionalCreate(2, MusicDialogComponent_Conditional_2_Template, 1, 2, "app-music-edit", 2);
10890    }
10891    if (rf & 2) {
10892      \u0275\u0275property("hidden", ctx.view() !== "search")("userList", ctx.userList())("selectedTrack", ctx.selectedTrack())("filterGenre", ctx.filterGenre)("filterCountry", ctx.filterCountry);
10893      \u0275\u0275advance();
10894      \u0275\u0275conditional(ctx.view() === "filter" ? 1 : -1);
10895      \u0275\u0275advance();
10896      \u0275\u0275conditional(ctx.view() === "edit" ? 2 : -1);
10897    }
10898  }, dependencies: [MusicSearchComponent, MusicFilterComponent, MusicEditComponent], encapsulation: 2 });
10899};
10900(() => {
10901  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MusicDialogComponent, [{
10902    type: Component,
10903    args: [{ selector: "app-music-dialog", imports: [MusicSearchComponent, MusicFilterComponent, MusicEditComponent], template: `<app-music-search
10904  (trackSelected)="selectTrack($event)"
10905  (goToFilter)="view.set('filter')"
10906  (goToEdit)="view.set('edit')"
10907  [hidden]="view() !== 'search'"
10908  [userList]="userList()"
10909  [selectedTrack]="selectedTrack()"
10910  [filterGenre]="filterGenre"
10911  [filterCountry]="filterCountry"
10912/>
10913@if (view() === 'filter') {
10914<app-music-filter
10915  (apply)="filterGenre = $event.genre; filterCountry = $event.countryCode; view.set('search')"
10916  (cancel)="view.set('search')"
10917  [genre]="filterGenre"
10918  [countryCode]="filterCountry"
10919/>
10920} @if (view() === 'edit') {
10921<app-music-edit
10922  (apply)="applyMusicEdit($event); view.set('search')"
10923  (cancel)="view.set('search')"
10924  [music]="store.post().options.tiktok.music"
10925  [track]="selectedTrack()!"
10926/>
10927}
10928` }]
10929  }], null, null);
10930})();
10931(() => {
10932  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(MusicDialogComponent, { className: "MusicDialogComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/components/music-dialog/music-dialog.component.ts", lineNumber: 15 });
10933})();
10934
10935// libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/music.component.ts
10936function MusicComponent_Conditional_8_Template(rf, ctx) {
10937  if (rf & 1) {
10938    \u0275\u0275element(0, "app-music-dialog", 5);
10939  }
10940  if (rf & 2) {
10941    const ctx_r2 = \u0275\u0275nextContext();
10942    \u0275\u0275property("userList", ctx_r2.userList());
10943  }
10944}
10945var MusicComponent = class _MusicComponent {
10946  userList = input.required();
10947  store = inject(MessengerStore);
10948  static \u0275fac = function MusicComponent_Factory(__ngFactoryType__) {
10949    return new (__ngFactoryType__ || _MusicComponent)();
10950  };
10951  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _MusicComponent, selectors: [["app-music"]], inputs: { userList: [1, "userList"] }, decls: 9, vars: 13, consts: [["popover", ""], [1, "h-[4rem]", "flex", "flex-col", "justify-between"], [1, "text-sm", "font-semibold"], ["icon", "music", "iconStyleClass", "size-1!", 3, "click", "variant", "severity", "tooltip", "tooltipPosition", "styleClass"], ["styleClass", "no-gutter -mt-2!"], [3, "userList"]], template: function MusicComponent_Template(rf, ctx) {
10952    if (rf & 1) {
10953      const _r1 = \u0275\u0275getCurrentView();
10954      \u0275\u0275elementStart(0, "div", 1)(1, "h3", 2);
10955      \u0275\u0275text(2);
10956      \u0275\u0275pipe(3, "translate");
10957      \u0275\u0275elementEnd();
10958      \u0275\u0275elementStart(4, "ui-button", 3);
10959      \u0275\u0275pipe(5, "translate");
10960      \u0275\u0275listener("click", function MusicComponent_Template_ui_button_click_4_listener($event) {
10961        \u0275\u0275restoreView(_r1);
10962        const popover_r2 = \u0275\u0275reference(7);
10963        return \u0275\u0275resetView(popover_r2.toggle($event));
10964      });
10965      \u0275\u0275elementEnd()();
10966      \u0275\u0275elementStart(6, "ui-popover", 4, 0);
10967      \u0275\u0275conditionalCreate(8, MusicComponent_Conditional_8_Template, 1, 1, "app-music-dialog", 5);
10968      \u0275\u0275elementEnd();
10969    }
10970    if (rf & 2) {
10971      const popover_r2 = \u0275\u0275reference(7);
10972      const hasMusic_r4 = ctx.store.post().options.tiktok.has.music;
10973      \u0275\u0275advance(2);
10974      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(3, 9, "MESSENGER.TIKTOK.MUSIC"));
10975      \u0275\u0275advance(2);
10976      \u0275\u0275property("styleClass", \u0275\u0275interpolate2("size-9! aspect-square cursor-pointer\n    ", popover_r2.isOpen() && "bg-grey-50!", "\n    ", hasMusic_r4 && "bg-secondary-50!"))("variant", hasMusic_r4 ? "outlined" : void 0)("severity", hasMusic_r4 ? "secondary" : "contrast")("tooltip", \u0275\u0275pipeBind1(5, 11, "MESSENGER.TIKTOK.MUSIC"))("tooltipPosition", "top");
10977      \u0275\u0275advance(4);
10978      \u0275\u0275conditional(popover_r2.isOpen() ? 8 : -1);
10979    }
10980  }, dependencies: [TranslatePipe, ButtonComponent, TooltipDirective, PopoverComponent, MusicDialogComponent], encapsulation: 2 });
10981};
10982(() => {
10983  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MusicComponent, [{
10984    type: Component,
10985    args: [{ selector: "app-music", imports: [TranslatePipe, ButtonComponent, TooltipDirective, PopoverComponent, MusicDialogComponent], template: `@let hasMusic = store.post().options.tiktok.has.music;
10986
10987<div class="h-[4rem] flex flex-col justify-between">
10988  <h3 class="text-sm font-semibold">{{ 'MESSENGER.TIKTOK.MUSIC' | translate }}</h3>
10989
10990  <ui-button
10991    (click)="popover.toggle($event)"
10992    icon="music"
10993    [variant]="hasMusic ? 'outlined' : undefined"
10994    [severity]="hasMusic ? 'secondary' : 'contrast'"
10995    [tooltip]="'MESSENGER.TIKTOK.MUSIC' | translate"
10996    [tooltipPosition]="'top'"
10997    styleClass="size-9! aspect-square cursor-pointer
10998    {{ popover.isOpen() && 'bg-grey-50!' }}
10999    {{ hasMusic && 'bg-secondary-50!' }}"
11000    iconStyleClass="size-1!"
11001  />
11002</div>
11003
11004<ui-popover #popover styleClass="no-gutter -mt-2!">
11005  @if (popover.isOpen()) {
11006  <app-music-dialog [userList]="userList()" />
11007  }
11008</ui-popover>
11009` }]
11010  }], null, null);
11011})();
11012(() => {
11013  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(MusicComponent, { className: "MusicComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/music/music.component.ts", lineNumber: 12 });
11014})();
11015
11016// libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/promotion/promotion.component.ts
11017function PromotionComponent_ng_template_5_Template(rf, ctx) {
11018  if (rf & 1) {
11019    \u0275\u0275elementStart(0, "div", 4)(1, "h3");
11020    \u0275\u0275text(2);
11021    \u0275\u0275pipe(3, "translate");
11022    \u0275\u0275elementEnd()();
11023  }
11024  if (rf & 2) {
11025    const segment_r2 = ctx.$implicit;
11026    const active_r3 = ctx.active;
11027    \u0275\u0275advance();
11028    \u0275\u0275classMap(\u0275\u0275interpolate1("text-sm font-semibold ", active_r3 ? "text-secondary-500!" : "text-grey-300"));
11029    \u0275\u0275advance();
11030    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(3, 4, segment_r2.title), " ");
11031  }
11032}
11033var PromotionComponent = class _PromotionComponent {
11034  store = inject(MessengerStore);
11035  segments = [
11036    { title: "GLOBAL.NO", value: "no" },
11037    { title: "GLOBAL.YES", value: "yes" }
11038  ];
11039  get value() {
11040    return this.store.post().options.tiktok.promoted ? "yes" : "no";
11041  }
11042  set value(val) {
11043    this.store.post().options.tiktok.set.promoted(val === "yes");
11044  }
11045  static \u0275fac = function PromotionComponent_Factory(__ngFactoryType__) {
11046    return new (__ngFactoryType__ || _PromotionComponent)();
11047  };
11048  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _PromotionComponent, selectors: [["app-promotion"]], decls: 7, vars: 5, consts: [["item", ""], [1, "h-[4rem]", "flex", "flex-col", "justify-between"], [1, "text-sm", "font-semibold"], ["mode", "radio", "itemStyleClass", "border-none!", "styleClass", "flex-row! gap-4! -mt-8! px-1", 1, "segment-thin", 2, "--p-card-body-padding", "0", "--p-card-border-radius", "var(--radius-base)", 3, "ngModelChange", "ngModel", "segments"], [1, "h-[1.75rem]", "w-[3rem]", "flex", "items-center", "justify-center"]], template: function PromotionComponent_Template(rf, ctx) {
11049    if (rf & 1) {
11050      const _r1 = \u0275\u0275getCurrentView();
11051      \u0275\u0275elementStart(0, "div", 1)(1, "h3", 2);
11052      \u0275\u0275text(2);
11053      \u0275\u0275pipe(3, "translate");
11054      \u0275\u0275elementEnd();
11055      \u0275\u0275elementStart(4, "ui-segment-list", 3);
11056      \u0275\u0275twoWayListener("ngModelChange", function PromotionComponent_Template_ui_segment_list_ngModelChange_4_listener($event) {
11057        \u0275\u0275restoreView(_r1);
11058        \u0275\u0275twoWayBindingSet(ctx.value, $event) || (ctx.value = $event);
11059        return \u0275\u0275resetView($event);
11060      });
11061      \u0275\u0275template(5, PromotionComponent_ng_template_5_Template, 4, 6, "ng-template", null, 0, \u0275\u0275templateRefExtractor);
11062      \u0275\u0275elementEnd()();
11063    }
11064    if (rf & 2) {
11065      \u0275\u0275advance(2);
11066      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(3, 3, "MESSENGER.TIKTOK.IS_PROMOTION"));
11067      \u0275\u0275advance(2);
11068      \u0275\u0275twoWayProperty("ngModel", ctx.value);
11069      \u0275\u0275property("segments", ctx.segments);
11070    }
11071  }, dependencies: [FormsModule, NgControlStatus, NgModel, TranslatePipe, SegmentListComponent], encapsulation: 2 });
11072};
11073(() => {
11074  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PromotionComponent, [{
11075    type: Component,
11076    args: [{ selector: "app-promotion", imports: [FormsModule, TranslatePipe, SegmentListComponent], template: `<div class="h-[4rem] flex flex-col justify-between">
11077  <h3 class="text-sm font-semibold">{{ 'MESSENGER.TIKTOK.IS_PROMOTION' | translate }}</h3>
11078
11079  <ui-segment-list
11080    [(ngModel)]="value"
11081    [segments]="segments"
11082    mode="radio"
11083    itemStyleClass="border-none!"
11084    styleClass="flex-row! gap-4! -mt-8! px-1"
11085    class="segment-thin"
11086    style="--p-card-body-padding: 0; --p-card-border-radius: var(--radius-base)"
11087  >
11088    <ng-template #item let-segment let-active="active">
11089      <div class="h-[1.75rem] w-[3rem] flex items-center justify-center">
11090        <h3 class="text-sm font-semibold {{ active ? 'text-secondary-500!' : 'text-grey-300' }}">
11091          {{ segment.title | translate }}
11092        </h3>
11093      </div>
11094    </ng-template>
11095  </ui-segment-list>
11096</div>
11097` }]
11098  }], null, null);
11099})();
11100(() => {
11101  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(PromotionComponent, { className: "PromotionComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/promotion/promotion.component.ts", lineNumber: 12 });
11102})();
11103
11104// libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/visibility/visibility.component.ts
11105function VisibilityComponent_ng_template_5_Template(rf, ctx) {
11106  if (rf & 1) {
11107    \u0275\u0275elementStart(0, "span", 5);
11108    \u0275\u0275text(1);
11109    \u0275\u0275pipe(2, "translate");
11110    \u0275\u0275elementEnd();
11111  }
11112  if (rf & 2) {
11113    const item_r1 = ctx.$implicit;
11114    \u0275\u0275advance();
11115    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(2, 1, item_r1.label));
11116  }
11117}
11118function VisibilityComponent_ng_template_6_Template(rf, ctx) {
11119  if (rf & 1) {
11120    \u0275\u0275elementStart(0, "span", 5);
11121    \u0275\u0275text(1);
11122    \u0275\u0275pipe(2, "translate");
11123    \u0275\u0275elementEnd();
11124  }
11125  if (rf & 2) {
11126    const item_r2 = ctx.$implicit;
11127    \u0275\u0275advance();
11128    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(2, 1, item_r2.label));
11129  }
11130}
11131var VisibilityComponent = class _VisibilityComponent {
11132  store = inject(MessengerStore);
11133  options = signal([
11134    { label: "MESSENGER.TIKTOK.VISIBILITY_PUBLIC", value: "PUBLIC_TO_EVERYONE" },
11135    { label: "MESSENGER.TIKTOK.VISIBILITY_FRIENDS", value: "MUTUAL_FOLLOW_FRIENDS" },
11136    { label: "MESSENGER.TIKTOK.VISIBILITY_PRIVATE", value: "SELF_ONLY" }
11137  ]);
11138  get value() {
11139    return this.store.post().options.tiktok.visibility;
11140  }
11141  set value(val) {
11142    this.store.post().options.tiktok.set.visibility(val);
11143  }
11144  static \u0275fac = function VisibilityComponent_Factory(__ngFactoryType__) {
11145    return new (__ngFactoryType__ || _VisibilityComponent)();
11146  };
11147  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _VisibilityComponent, selectors: [["app-visibility"]], decls: 7, vars: 5, consts: [[1, "h-[4rem]", "flex", "flex-col", "justify-between"], [1, "text-sm", "font-semibold"], ["optionLabel", "label", "optionValue", "value", "size", "small", "panelStyleClass", "w-[15rem] h-[9.5rem]!", "styleClass", "w-[10rem]", 2, "--p-select-dropdown-width", "20px", "--p-select-sm-padding-x", "0.625rem 0", "--p-select-sm-padding-y", "0.47rem", 3, "ngModelChange", "ngModel", "options"], ["selectSelectedItem", ""], ["selectItem", ""], [1, "text-sm"]], template: function VisibilityComponent_Template(rf, ctx) {
11148    if (rf & 1) {
11149      \u0275\u0275elementStart(0, "div", 0)(1, "h3", 1);
11150      \u0275\u0275text(2);
11151      \u0275\u0275pipe(3, "translate");
11152      \u0275\u0275elementEnd();
11153      \u0275\u0275elementStart(4, "ui-select", 2);
11154      \u0275\u0275twoWayListener("ngModelChange", function VisibilityComponent_Template_ui_select_ngModelChange_4_listener($event) {
11155        \u0275\u0275twoWayBindingSet(ctx.value, $event) || (ctx.value = $event);
11156        return $event;
11157      });
11158      \u0275\u0275template(5, VisibilityComponent_ng_template_5_Template, 3, 3, "ng-template", 3)(6, VisibilityComponent_ng_template_6_Template, 3, 3, "ng-template", 4);
11159      \u0275\u0275elementEnd()();
11160    }
11161    if (rf & 2) {
11162      \u0275\u0275advance(2);
11163      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(3, 3, "MESSENGER.TIKTOK.VISIBILITY"));
11164      \u0275\u0275advance(2);
11165      \u0275\u0275twoWayProperty("ngModel", ctx.value);
11166      \u0275\u0275property("options", ctx.options());
11167    }
11168  }, dependencies: [FormsModule, NgControlStatus, NgModel, TranslatePipe, SelectComponent], encapsulation: 2 });
11169};
11170(() => {
11171  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(VisibilityComponent, [{
11172    type: Component,
11173    args: [{ selector: "app-visibility", imports: [FormsModule, TranslatePipe, SelectComponent], template: `<div class="h-[4rem] flex flex-col justify-between">
11174  <h3 class="text-sm font-semibold">{{ 'MESSENGER.TIKTOK.VISIBILITY' | translate }}</h3>
11175
11176  <ui-select
11177    [(ngModel)]="value"
11178    [options]="options()"
11179    optionLabel="label"
11180    optionValue="value"
11181    size="small"
11182    panelStyleClass="w-[15rem] h-[9.5rem]!"
11183    styleClass="w-[10rem]"
11184    style="--p-select-dropdown-width: 20px; --p-select-sm-padding-x: 0.625rem 0; --p-select-sm-padding-y: 0.47rem"
11185  >
11186    <ng-template selectSelectedItem let-item>
11187      <span class="text-sm">{{ item.label | translate }}</span>
11188    </ng-template>
11189    <ng-template selectItem let-item>
11190      <span class="text-sm">{{ item.label | translate }}</span>
11191    </ng-template>
11192  </ui-select>
11193</div>
11194` }]
11195  }], null, null);
11196})();
11197(() => {
11198  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(VisibilityComponent, { className: "VisibilityComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/visibility/visibility.component.ts", lineNumber: 12 });
11199})();
11200
11201// libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/user-actions/user-actions.component.ts
11202var UserActionsComponent = class _UserActionsComponent {
11203  store = inject(MessengerStore);
11204  get allowComment() {
11205    return this.store.post().options.tiktok.allowComment;
11206  }
11207  set allowComment(val) {
11208    this.store.post().options.tiktok.set.allowComment(val);
11209  }
11210  get allowDuet() {
11211    return this.store.post().options.tiktok.allowDuet;
11212  }
11213  set allowDuet(val) {
11214    this.store.post().options.tiktok.set.allowDuet(val);
11215  }
11216  get allowStitch() {
11217    return this.store.post().options.tiktok.allowStitch;
11218  }
11219  set allowStitch(val) {
11220    this.store.post().options.tiktok.set.allowStitch(val);
11221  }
11222  static \u0275fac = function UserActionsComponent_Factory(__ngFactoryType__) {
11223    return new (__ngFactoryType__ || _UserActionsComponent)();
11224  };
11225  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _UserActionsComponent, selectors: [["app-user-actions"]], decls: 14, vars: 21, consts: [[1, "h-[4rem]", "flex", "flex-col", "justify-between"], [1, "text-sm", "font-semibold"], [1, "flex", "items-center", "gap-2"], [3, "click"]], template: function UserActionsComponent_Template(rf, ctx) {
11226    if (rf & 1) {
11227      \u0275\u0275elementStart(0, "div", 0)(1, "h3", 1);
11228      \u0275\u0275text(2);
11229      \u0275\u0275pipe(3, "translate");
11230      \u0275\u0275elementEnd();
11231      \u0275\u0275elementStart(4, "div", 2)(5, "button", 3);
11232      \u0275\u0275listener("click", function UserActionsComponent_Template_button_click_5_listener() {
11233        return ctx.allowComment = !ctx.allowComment;
11234      });
11235      \u0275\u0275text(6);
11236      \u0275\u0275pipe(7, "translate");
11237      \u0275\u0275elementEnd();
11238      \u0275\u0275elementStart(8, "button", 3);
11239      \u0275\u0275listener("click", function UserActionsComponent_Template_button_click_8_listener() {
11240        return ctx.allowDuet = !ctx.allowDuet;
11241      });
11242      \u0275\u0275text(9);
11243      \u0275\u0275pipe(10, "translate");
11244      \u0275\u0275elementEnd();
11245      \u0275\u0275elementStart(11, "button", 3);
11246      \u0275\u0275listener("click", function UserActionsComponent_Template_button_click_11_listener() {
11247        return ctx.allowStitch = !ctx.allowStitch;
11248      });
11249      \u0275\u0275text(12);
11250      \u0275\u0275pipe(13, "translate");
11251      \u0275\u0275elementEnd()()();
11252    }
11253    if (rf & 2) {
11254      \u0275\u0275advance(2);
11255      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(3, 13, "MESSENGER.TIKTOK.USER_ACTIONS"));
11256      \u0275\u0275advance(3);
11257      \u0275\u0275classMap(\u0275\u0275interpolate1("h-[2.25rem] px-3 rounded-lg border cursor-pointer text-sm font-semibold transition-colors\n        ", ctx.allowComment ? "bg-secondary-50 border-secondary-500 text-secondary-500" : "bg-white border-grey-100 text-grey-300"));
11258      \u0275\u0275advance();
11259      \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(7, 15, "MESSENGER.TIKTOK.COMMENT"), " ");
11260      \u0275\u0275advance(2);
11261      \u0275\u0275classMap(\u0275\u0275interpolate1("h-[2.25rem] px-3 rounded-lg border cursor-pointer text-sm font-semibold transition-colors\n        ", ctx.allowDuet ? "bg-secondary-50 border-secondary-500 text-secondary-500" : "bg-white border-grey-100 text-grey-300"));
11262      \u0275\u0275advance();
11263      \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(10, 17, "MESSENGER.TIKTOK.DUET"), " ");
11264      \u0275\u0275advance(2);
11265      \u0275\u0275classMap(\u0275\u0275interpolate1("h-[2.25rem] px-3 rounded-lg border cursor-pointer text-sm font-semibold transition-colors\n        ", ctx.allowStitch ? "bg-secondary-50 border-secondary-500 text-secondary-500" : "bg-white border-grey-100 text-grey-300"));
11266      \u0275\u0275advance();
11267      \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(13, 19, "MESSENGER.TIKTOK.STITCH"), " ");
11268    }
11269  }, dependencies: [TranslatePipe], encapsulation: 2 });
11270};
11271(() => {
11272  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(UserActionsComponent, [{
11273    type: Component,
11274    args: [{ selector: "app-user-actions", imports: [TranslatePipe], template: `<div class="h-[4rem] flex flex-col justify-between">
11275  <h3 class="text-sm font-semibold">{{ 'MESSENGER.TIKTOK.USER_ACTIONS' | translate }}</h3>
11276
11277  <div class="flex items-center gap-2">
11278    <button
11279      (click)="allowComment = !allowComment"
11280      class="h-[2.25rem] px-3 rounded-lg border cursor-pointer text-sm font-semibold transition-colors
11281        {{
11282        allowComment
11283          ? 'bg-secondary-50 border-secondary-500 text-secondary-500'
11284          : 'bg-white border-grey-100 text-grey-300'
11285      }}"
11286    >
11287      {{ 'MESSENGER.TIKTOK.COMMENT' | translate }}
11288    </button>
11289
11290    <button
11291      (click)="allowDuet = !allowDuet"
11292      class="h-[2.25rem] px-3 rounded-lg border cursor-pointer text-sm font-semibold transition-colors
11293        {{
11294        allowDuet ? 'bg-secondary-50 border-secondary-500 text-secondary-500' : 'bg-white border-grey-100 text-grey-300'
11295      }}"
11296    >
11297      {{ 'MESSENGER.TIKTOK.DUET' | translate }}
11298    </button>
11299
11300    <button
11301      (click)="allowStitch = !allowStitch"
11302      class="h-[2.25rem] px-3 rounded-lg border cursor-pointer text-sm font-semibold transition-colors
11303        {{
11304        allowStitch
11305          ? 'bg-secondary-50 border-secondary-500 text-secondary-500'
11306          : 'bg-white border-grey-100 text-grey-300'
11307      }}"
11308    >
11309      {{ 'MESSENGER.TIKTOK.STITCH' | translate }}
11310    </button>
11311  </div>
11312</div>
11313` }]
11314  }], null, null);
11315})();
11316(() => {
11317  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(UserActionsComponent, { className: "UserActionsComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/tiktok/components/user-actions/user-actions.component.ts", lineNumber: 10 });
11318})();
11319
11320// libs/socialgest/messenger/src/presenter/components/extras/tiktok/tiktok.component.ts
11321function TiktokComponent_Conditional_11_Template(rf, ctx) {
11322  if (rf & 1) {
11323    \u0275\u0275element(0, "app-location", 5);
11324  }
11325  if (rf & 2) {
11326    \u0275\u0275nextContext();
11327    const userList_r1 = \u0275\u0275readContextLet(1);
11328    \u0275\u0275property("userList", userList_r1)("userType", userList_r1.first.type);
11329  }
11330}
11331var TiktokComponent = class _TiktokComponent {
11332  store = inject(MessengerStore);
11333  static \u0275fac = function TiktokComponent_Factory(__ngFactoryType__) {
11334    return new (__ngFactoryType__ || _TiktokComponent)();
11335  };
11336  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _TiktokComponent, selectors: [["app-tiktok"]], decls: 13, vars: 6, consts: [[1, "grid", "grid-cols-[auto_auto_auto_auto]", "gap-2"], [3, "userList"], [1, "flex", "flex-col", "gap-1"], [1, "text-sm", "font-semibold"], [1, "flex", "gap-3"], [3, "userList", "userType"]], template: function TiktokComponent_Template(rf, ctx) {
11337    if (rf & 1) {
11338      \u0275\u0275elementStart(0, "section", 0);
11339      \u0275\u0275declareLet(1);
11340      \u0275\u0275element(2, "app-music", 1)(3, "app-promotion")(4, "app-visibility")(5, "app-user-actions");
11341      \u0275\u0275elementStart(6, "div", 2)(7, "h3", 3);
11342      \u0275\u0275text(8);
11343      \u0275\u0275pipe(9, "translate");
11344      \u0275\u0275elementEnd();
11345      \u0275\u0275elementStart(10, "div", 4);
11346      \u0275\u0275conditionalCreate(11, TiktokComponent_Conditional_11_Template, 1, 2, "app-location", 5);
11347      \u0275\u0275element(12, "app-url-shortener");
11348      \u0275\u0275elementEnd()()();
11349    }
11350    if (rf & 2) {
11351      \u0275\u0275advance();
11352      const userList_r2 = \u0275\u0275storeLet(ctx.store.post().userList.tiktok);
11353      \u0275\u0275advance();
11354      \u0275\u0275property("userList", userList_r2);
11355      \u0275\u0275advance(6);
11356      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(9, 4, "MESSENGER.EXTRAS"));
11357      \u0275\u0275advance(3);
11358      \u0275\u0275conditional(userList_r2.first.isTiktokBusiness ? 11 : -1);
11359    }
11360  }, dependencies: [
11361    TranslatePipe,
11362    MusicComponent,
11363    PromotionComponent,
11364    VisibilityComponent,
11365    UserActionsComponent,
11366    UrlShortenerComponent,
11367    LocationComponent
11368  ], encapsulation: 2 });
11369};
11370(() => {
11371  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(TiktokComponent, [{
11372    type: Component,
11373    args: [{ selector: "app-tiktok", imports: [
11374      TranslatePipe,
11375      MusicComponent,
11376      PromotionComponent,
11377      VisibilityComponent,
11378      UserActionsComponent,
11379      UrlShortenerComponent,
11380      LocationComponent
11381    ], template: `<section class="grid grid-cols-[auto_auto_auto_auto] gap-2">
11382  @let userList = store.post().userList.tiktok;
11383  <app-music [userList]="userList" />
11384  <app-promotion />
11385  <app-visibility />
11386  <app-user-actions />
11387
11388  <div class="flex flex-col gap-1">
11389    <h3 class="text-sm font-semibold">{{ 'MESSENGER.EXTRAS' | translate }}</h3>
11390
11391    <div class="flex gap-3">
11392      @if (userList.first.isTiktokBusiness) {
11393      <app-location [userList]="userList" [userType]="userList.first.type" />
11394      }
11395      <app-url-shortener />
11396    </div>
11397  </div>
11398</section>
11399` }]
11400  }], null, null);
11401})();
11402(() => {
11403  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(TiktokComponent, { className: "TiktokComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/tiktok/tiktok.component.ts", lineNumber: 20 });
11404})();
11405
11406// libs/socialgest/messenger/src/presenter/components/extras/google-business/constants/cta-options.constant.ts
11407var CTA_OPTIONS = [
11408  { label: "MESSENGER.GOOGLE_BUSINESS.CTA_NONE", value: null },
11409  { label: "MESSENGER.GOOGLE_BUSINESS.CTA_BOOK", value: "BOOK" },
11410  { label: "MESSENGER.GOOGLE_BUSINESS.CTA_ORDER", value: "ORDER" },
11411  { label: "MESSENGER.GOOGLE_BUSINESS.CTA_SHOP", value: "SHOP" },
11412  { label: "MESSENGER.GOOGLE_BUSINESS.CTA_LEARN_MORE", value: "LEARN_MORE" },
11413  { label: "MESSENGER.GOOGLE_BUSINESS.CTA_SIGN_UP", value: "SIGN_UP" },
11414  { label: "MESSENGER.GOOGLE_BUSINESS.CTA_CALL", value: "CALL" }
11415];
11416
11417// libs/socialgest/messenger/src/presenter/components/extras/google-business/google-business.component.ts
11418function GoogleBusinessComponent_Conditional_6_Conditional_1_Template(rf, ctx) {
11419  if (rf & 1) {
11420    \u0275\u0275elementStart(0, "span", 2);
11421    \u0275\u0275text(1);
11422    \u0275\u0275pipe(2, "translate");
11423    \u0275\u0275elementEnd();
11424  }
11425  if (rf & 2) {
11426    \u0275\u0275advance();
11427    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(2, 1, "MESSENGER.GOOGLE_BUSINESS.CTA_LINK_LABEL"));
11428  }
11429}
11430function GoogleBusinessComponent_Conditional_6_Template(rf, ctx) {
11431  if (rf & 1) {
11432    const _r1 = \u0275\u0275getCurrentView();
11433    \u0275\u0275elementStart(0, "div", 4);
11434    \u0275\u0275conditionalCreate(1, GoogleBusinessComponent_Conditional_6_Conditional_1_Template, 3, 3, "span", 2);
11435    \u0275\u0275elementStart(2, "ui-input-text", 7);
11436    \u0275\u0275pipe(3, "translate");
11437    \u0275\u0275listener("ngModelChange", function GoogleBusinessComponent_Conditional_6_Template_ui_input_text_ngModelChange_2_listener($event) {
11438      \u0275\u0275restoreView(_r1);
11439      const ctx_r1 = \u0275\u0275nextContext();
11440      return \u0275\u0275resetView(ctx_r1.onCtaUrlChange($event));
11441    });
11442    \u0275\u0275elementEnd()();
11443  }
11444  if (rf & 2) {
11445    const ctx_r1 = \u0275\u0275nextContext();
11446    \u0275\u0275advance();
11447    \u0275\u0275conditional(!ctx_r1.isCallType() ? 1 : -1);
11448    \u0275\u0275advance();
11449    \u0275\u0275property("ngModel", ctx_r1.ctaUrl())("disabled", ctx_r1.isCallType())("placeholder", \u0275\u0275pipeBind1(3, 4, ctx_r1.isCallType() ? "MESSENGER.GOOGLE_BUSINESS.CTA_PHONE_PLACEHOLDER" : "MESSENGER.GOOGLE_BUSINESS.CTA_URL_PLACEHOLDER"));
11450  }
11451}
11452var GoogleBusinessComponent = class _GoogleBusinessComponent {
11453  store = inject(MessengerStore);
11454  ctaOptions = CTA_OPTIONS;
11455  ctaType = computed(() => this.store.post().options.googleBusiness.ctaType);
11456  ctaUrl = computed(() => this.store.post().options.googleBusiness.ctaUrl);
11457  hasCta = computed(() => this.store.post().options.googleBusiness.has.cta);
11458  isCallType = computed(() => this.ctaType() === "CALL");
11459  onCtaTypeChange(value) {
11460    this.store.post().options.googleBusiness.set.ctaType(value);
11461    if (!value || value === "CALL") {
11462      this.store.post().options.googleBusiness.set.ctaUrl("");
11463    }
11464    this.store.refresh();
11465  }
11466  onCtaUrlChange(value) {
11467    this.store.post().options.googleBusiness.set.ctaUrl(value);
11468    this.store.refresh();
11469  }
11470  static \u0275fac = function GoogleBusinessComponent_Factory(__ngFactoryType__) {
11471    return new (__ngFactoryType__ || _GoogleBusinessComponent)();
11472  };
11473  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _GoogleBusinessComponent, selectors: [["app-google-business"]], decls: 13, vars: 11, consts: [[1, "flex", "gap-4"], [1, "flex-1", "flex", "flex-col", "gap-1", "max-w-72"], [1, "text-sm", "font-bold", "text-grey-500"], ["optionLabel", "label", "optionValue", "value", 3, "ngModelChange", "options", "ngModel", "translateLabels", "clearable"], [1, "flex-1", "flex", "flex-col", "gap-1", "justify-end"], [1, "flex", "flex-col", "gap-2.5"], [1, "text-sm", "font-semibold"], [3, "ngModelChange", "ngModel", "disabled", "placeholder"]], template: function GoogleBusinessComponent_Template(rf, ctx) {
11474    if (rf & 1) {
11475      \u0275\u0275elementStart(0, "section", 0)(1, "div", 1)(2, "span", 2);
11476      \u0275\u0275text(3);
11477      \u0275\u0275pipe(4, "translate");
11478      \u0275\u0275elementEnd();
11479      \u0275\u0275elementStart(5, "ui-select", 3);
11480      \u0275\u0275listener("ngModelChange", function GoogleBusinessComponent_Template_ui_select_ngModelChange_5_listener($event) {
11481        return ctx.onCtaTypeChange($event);
11482      });
11483      \u0275\u0275elementEnd()();
11484      \u0275\u0275conditionalCreate(6, GoogleBusinessComponent_Conditional_6_Template, 4, 6, "div", 4);
11485      \u0275\u0275elementStart(7, "div", 5)(8, "h3", 6);
11486      \u0275\u0275text(9);
11487      \u0275\u0275pipe(10, "translate");
11488      \u0275\u0275elementEnd();
11489      \u0275\u0275elementStart(11, "div", 0);
11490      \u0275\u0275element(12, "app-url-shortener");
11491      \u0275\u0275elementEnd()()();
11492    }
11493    if (rf & 2) {
11494      \u0275\u0275advance(3);
11495      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 7, "MESSENGER.GOOGLE_BUSINESS.CTA_TITLE"));
11496      \u0275\u0275advance(2);
11497      \u0275\u0275property("options", ctx.ctaOptions)("ngModel", ctx.ctaType())("translateLabels", true)("clearable", true);
11498      \u0275\u0275advance();
11499      \u0275\u0275conditional(ctx.hasCta() ? 6 : -1);
11500      \u0275\u0275advance(3);
11501      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(10, 9, "MESSENGER.EXTRAS"));
11502    }
11503  }, dependencies: [CommonModule, FormsModule, NgControlStatus, NgModel, TranslatePipe, SelectComponent, InputTextComponent, UrlShortenerComponent], encapsulation: 2 });
11504};
11505(() => {
11506  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(GoogleBusinessComponent, [{
11507    type: Component,
11508    args: [{ selector: "app-google-business", imports: [CommonModule, FormsModule, TranslatePipe, SelectComponent, InputTextComponent, UrlShortenerComponent], template: `<section class="flex gap-4">
11509  <div class="flex-1 flex flex-col gap-1 max-w-72">
11510    <span class="text-sm font-bold text-grey-500">{{ 'MESSENGER.GOOGLE_BUSINESS.CTA_TITLE' | translate }}</span>
11511    <ui-select
11512      [options]="ctaOptions"
11513      [ngModel]="ctaType()"
11514      (ngModelChange)="onCtaTypeChange($event)"
11515      optionLabel="label"
11516      optionValue="value"
11517      [translateLabels]="true"
11518      [clearable]="true"
11519    />
11520  </div>
11521
11522  @if (hasCta()) {
11523  <div class="flex-1 flex flex-col gap-1 justify-end">
11524    @if (!isCallType()) {
11525    <span class="text-sm font-bold text-grey-500">{{ 'MESSENGER.GOOGLE_BUSINESS.CTA_LINK_LABEL' | translate }}</span>
11526    }
11527    <ui-input-text
11528      [ngModel]="ctaUrl()"
11529      (ngModelChange)="onCtaUrlChange($event)"
11530      [disabled]="isCallType()"
11531      [placeholder]="
11532        (isCallType()
11533          ? 'MESSENGER.GOOGLE_BUSINESS.CTA_PHONE_PLACEHOLDER'
11534          : 'MESSENGER.GOOGLE_BUSINESS.CTA_URL_PLACEHOLDER'
11535        ) | translate
11536      "
11537    />
11538  </div>
11539  }
11540
11541  <div class="flex flex-col gap-2.5">
11542    <h3 class="text-sm font-semibold">{{ 'MESSENGER.EXTRAS' | translate }}</h3>
11543
11544    <div class="flex gap-4">
11545      <app-url-shortener />
11546    </div>
11547  </div>
11548</section>
11549` }]
11550  }], null, null);
11551})();
11552(() => {
11553  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(GoogleBusinessComponent, { className: "GoogleBusinessComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/google-business/google-business.component.ts", lineNumber: 15 });
11554})();
11555
11556// libs/socialgest/messenger/src/presenter/components/extras/linkedin/components/pdf-carousel/pdf-carousel.component.ts
11557function PdfCarouselComponent_Conditional_0_Template(rf, ctx) {
11558  if (rf & 1) {
11559    const _r2 = \u0275\u0275getCurrentView();
11560    \u0275\u0275elementStart(0, "ui-button", 10);
11561    \u0275\u0275pipe(1, "translate");
11562    \u0275\u0275listener("click", function PdfCarouselComponent_Conditional_0_Template_ui_button_click_0_listener($event) {
11563      \u0275\u0275restoreView(_r2);
11564      \u0275\u0275nextContext();
11565      const popover_r3 = \u0275\u0275reference(2);
11566      return \u0275\u0275resetView(popover_r3.toggle($event));
11567    });
11568    \u0275\u0275elementEnd();
11569  }
11570  if (rf & 2) {
11571    const ctx_r3 = \u0275\u0275nextContext();
11572    const popover_r3 = \u0275\u0275reference(2);
11573    \u0275\u0275property("styleClass", \u0275\u0275interpolate2("\n  ", popover_r3.isOpen() && "bg-grey-50!", "\n  ", ctx_r3.isActive() && "bg-secondary-50!"))("variant", ctx_r3.isActive() ? "outlined" : void 0)("severity", ctx_r3.isActive() ? "secondary" : "contrast")("tooltip", \u0275\u0275pipeBind1(1, 8, "MESSENGER.LINKEDIN_PDF.TITLE"))("tooltipPosition", "top")("positionTop", -10);
11574  }
11575}
11576var PdfCarouselComponent = class _PdfCarouselComponent {
11577  store = inject(MessengerStore);
11578  pdfService = inject(LinkedInPdfService);
11579  isLoading = signal(false);
11580  isActive = computed(() => this.store.post().options.linkedin.has.pdf);
11581  canActivate = computed(() => this.pdfService.canActivate());
11582  title = signal("");
11583  ngOnInit() {
11584    const title = this.store.post().multimediaList.first?.altText;
11585    if (title) {
11586      this.title.set(title);
11587    }
11588  }
11589  toggle() {
11590    return __async(this, null, function* () {
11591      if (this.isActive()) {
11592        this.store.post().options.linkedin.set.pdfUrl("");
11593        this.store.refresh();
11594        return;
11595      }
11596      this.isLoading.set(true);
11597      const url = yield this.pdfService.convertAndUpload();
11598      if (url) {
11599        this.store.post().options.linkedin.set.pdfUrl(url);
11600        this.store.refresh();
11601      }
11602      this.isLoading.set(false);
11603    });
11604  }
11605  onTitleChange(value) {
11606    this.title.set(value);
11607    const first = this.store.post().multimediaList.first;
11608    if (first) {
11609      first.data["altText"] = value;
11610      this.store.refresh();
11611    }
11612  }
11613  static \u0275fac = function PdfCarouselComponent_Factory(__ngFactoryType__) {
11614    return new (__ngFactoryType__ || _PdfCarouselComponent)();
11615  };
11616  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _PdfCarouselComponent, selectors: [["app-pdf-carousel"]], hostVars: 2, hostBindings: function PdfCarouselComponent_HostBindings(rf, ctx) {
11617    if (rf & 2) {
11618      \u0275\u0275styleProp("display", ctx.canActivate() || ctx.isActive() ? null : "none");
11619    }
11620  }, decls: 15, vars: 15, consts: [["popover", ""], ["icon", "fileText", 1, "cursor-pointer", 3, "variant", "severity", "tooltip", "tooltipPosition", "positionTop", "styleClass"], ["styleClass", "w-[20rem] h-[13rem] -mt-5! no-gutter"], [1, "p-5", "flex", "flex-col", "gap-3"], [1, "flex", "items-center", "justify-between"], [1, "font-semibold"], ["size", "small", 3, "click", "label", "severity", "isLoading"], [1, "flex", "flex-col", "gap-1"], [1, "text-xs", "font-semibold", "text-grey-400"], [3, "ngModelChange", "ngModel", "placeholder", "disabled"], ["icon", "fileText", 1, "cursor-pointer", 3, "click", "variant", "severity", "tooltip", "tooltipPosition", "positionTop", "styleClass"]], template: function PdfCarouselComponent_Template(rf, ctx) {
11621    if (rf & 1) {
11622      const _r1 = \u0275\u0275getCurrentView();
11623      \u0275\u0275conditionalCreate(0, PdfCarouselComponent_Conditional_0_Template, 2, 10, "ui-button", 1);
11624      \u0275\u0275elementStart(1, "ui-popover", 2, 0)(3, "article", 3)(4, "header", 4)(5, "h3", 5);
11625      \u0275\u0275text(6);
11626      \u0275\u0275pipe(7, "translate");
11627      \u0275\u0275elementEnd();
11628      \u0275\u0275elementStart(8, "ui-button", 6);
11629      \u0275\u0275listener("click", function PdfCarouselComponent_Template_ui_button_click_8_listener() {
11630        \u0275\u0275restoreView(_r1);
11631        return \u0275\u0275resetView(ctx.toggle());
11632      });
11633      \u0275\u0275elementEnd()();
11634      \u0275\u0275elementStart(9, "div", 7)(10, "span", 8);
11635      \u0275\u0275text(11);
11636      \u0275\u0275pipe(12, "translate");
11637      \u0275\u0275elementEnd();
11638      \u0275\u0275elementStart(13, "ui-input-text", 9);
11639      \u0275\u0275pipe(14, "translate");
11640      \u0275\u0275listener("ngModelChange", function PdfCarouselComponent_Template_ui_input_text_ngModelChange_13_listener($event) {
11641        \u0275\u0275restoreView(_r1);
11642        return \u0275\u0275resetView(ctx.onTitleChange($event));
11643      });
11644      \u0275\u0275elementEnd()()()();
11645    }
11646    if (rf & 2) {
11647      \u0275\u0275conditional(ctx.canActivate() || ctx.isActive() ? 0 : -1);
11648      \u0275\u0275advance(6);
11649      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(7, 9, "MESSENGER.LINKEDIN_PDF.TITLE"));
11650      \u0275\u0275advance(2);
11651      \u0275\u0275property("label", ctx.isActive() ? "ALERT_BAR.ACTIONS.DEACTIVATE" : "ALERT_BAR.ACTIONS.ACTIVATE")("severity", ctx.isActive() ? "contrast" : "secondary")("isLoading", ctx.isLoading());
11652      \u0275\u0275advance(3);
11653      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(12, 11, "MESSENGER.LINKEDIN_PDF.DOCUMENT_TITLE"));
11654      \u0275\u0275advance(2);
11655      \u0275\u0275property("ngModel", ctx.title())("placeholder", \u0275\u0275pipeBind1(14, 13, "MESSENGER.LINKEDIN_PDF.DOCUMENT_TITLE_PLACEHOLDER"))("disabled", !ctx.isActive());
11656    }
11657  }, dependencies: [
11658    CommonModule,
11659    FormsModule,
11660    NgControlStatus,
11661    NgModel,
11662    TranslatePipe,
11663    PopoverComponent,
11664    ButtonComponent,
11665    TooltipDirective,
11666    InputTextComponent
11667  ], encapsulation: 2 });
11668};
11669(() => {
11670  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PdfCarouselComponent, [{
11671    type: Component,
11672    args: [{ selector: "app-pdf-carousel", imports: [
11673      CommonModule,
11674      FormsModule,
11675      TranslatePipe,
11676      PopoverComponent,
11677      ButtonComponent,
11678      TooltipDirective,
11679      InputTextComponent
11680    ], host: { "[style.display]": "canActivate() || isActive() ? null : 'none'" }, template: `@if (canActivate() || isActive()) {
11681<ui-button
11682  (click)="popover.toggle($event)"
11683  icon="fileText"
11684  [variant]="isActive() ? 'outlined' : undefined"
11685  [severity]="isActive() ? 'secondary' : 'contrast'"
11686  [tooltip]="'MESSENGER.LINKEDIN_PDF.TITLE' | translate"
11687  [tooltipPosition]="'top'"
11688  [positionTop]="-10"
11689  class="cursor-pointer"
11690  styleClass="
11691  {{ popover.isOpen() && 'bg-grey-50!' }}
11692  {{ isActive() && 'bg-secondary-50!' }}"
11693/>
11694}
11695
11696<ui-popover #popover styleClass="w-[20rem] h-[13rem] -mt-5! no-gutter">
11697  <article class="p-5 flex flex-col gap-3">
11698    <header class="flex items-center justify-between">
11699      <h3 class="font-semibold">{{ 'MESSENGER.LINKEDIN_PDF.TITLE' | translate }}</h3>
11700      <ui-button
11701        (click)="toggle()"
11702        [label]="isActive() ? 'ALERT_BAR.ACTIONS.DEACTIVATE' : 'ALERT_BAR.ACTIONS.ACTIVATE'"
11703        [severity]="isActive() ? 'contrast' : 'secondary'"
11704        size="small"
11705        [isLoading]="isLoading()"
11706      />
11707    </header>
11708
11709    <div class="flex flex-col gap-1">
11710      <span class="text-xs font-semibold text-grey-400">{{ 'MESSENGER.LINKEDIN_PDF.DOCUMENT_TITLE' | translate }}</span>
11711      <ui-input-text
11712        [ngModel]="title()"
11713        (ngModelChange)="onTitleChange($event)"
11714        [placeholder]="'MESSENGER.LINKEDIN_PDF.DOCUMENT_TITLE_PLACEHOLDER' | translate"
11715        [disabled]="!isActive()"
11716      />
11717    </div>
11718  </article>
11719</ui-popover>
11720` }]
11721  }], null, null);
11722})();
11723(() => {
11724  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(PdfCarouselComponent, { className: "PdfCarouselComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/linkedin/components/pdf-carousel/pdf-carousel.component.ts", lineNumber: 22 });
11725})();
11726
11727// libs/socialgest/messenger/src/presenter/components/extras/linkedin/linkedin.component.ts
11728var LinkedinExtrasComponent = class _LinkedinExtrasComponent {
11729  store = inject(MessengerStore);
11730  userType = UserType.LINKEDIN;
11731  static \u0275fac = function LinkedinExtrasComponent_Factory(__ngFactoryType__) {
11732    return new (__ngFactoryType__ || _LinkedinExtrasComponent)();
11733  };
11734  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _LinkedinExtrasComponent, selectors: [["app-linkedin"]], decls: 9, vars: 4, consts: [[1, "flex", "gap-12"], [1, "flex", "flex-col", "gap-2.5"], [1, "text-sm", "font-semibold"], [1, "flex", "gap-4"], [3, "userType"]], template: function LinkedinExtrasComponent_Template(rf, ctx) {
11735    if (rf & 1) {
11736      \u0275\u0275elementStart(0, "section", 0)(1, "div", 1)(2, "h3", 2);
11737      \u0275\u0275text(3);
11738      \u0275\u0275pipe(4, "translate");
11739      \u0275\u0275elementEnd();
11740      \u0275\u0275elementStart(5, "div", 3);
11741      \u0275\u0275element(6, "app-mention", 4)(7, "app-pdf-carousel")(8, "app-url-shortener");
11742      \u0275\u0275elementEnd()()();
11743    }
11744    if (rf & 2) {
11745      \u0275\u0275advance(3);
11746      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 2, "MESSENGER.EXTRAS"));
11747      \u0275\u0275advance(3);
11748      \u0275\u0275property("userType", ctx.userType);
11749    }
11750  }, dependencies: [TranslatePipe, PdfCarouselComponent, MentionComponent, UrlShortenerComponent], encapsulation: 2 });
11751};
11752(() => {
11753  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(LinkedinExtrasComponent, [{
11754    type: Component,
11755    args: [{ selector: "app-linkedin", imports: [TranslatePipe, PdfCarouselComponent, MentionComponent, UrlShortenerComponent], template: `<section class="flex gap-12">
11756  <div class="flex flex-col gap-2.5">
11757    <h3 class="text-sm font-semibold">{{ 'MESSENGER.EXTRAS' | translate }}</h3>
11758
11759    <div class="flex gap-4">
11760      <app-mention [userType]="userType" />
11761      <app-pdf-carousel />
11762      <app-url-shortener />
11763    </div>
11764  </div>
11765</section>
11766` }]
11767  }], null, null);
11768})();
11769(() => {
11770  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(LinkedinExtrasComponent, { className: "LinkedinExtrasComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/linkedin/linkedin.component.ts", lineNumber: 13 });
11771})();
11772
11773// libs/socialgest/messenger/src/presenter/components/extras/pinterest/components/title/title.component.ts
11774var PinterestTitleComponent = class _PinterestTitleComponent {
11775  MAX_LENGTH = 100;
11776  store = inject(MessengerStore);
11777  control = new FormControl("", [Validators.maxLength(this.MAX_LENGTH)]);
11778  ngOnInit() {
11779    this.control.setValue(this.store.post().options.pinterest.title);
11780  }
11781  confirm() {
11782    if (this.control.invalid)
11783      return;
11784    this.store.post().options.pinterest.set.title(this.control.value);
11785    this.store.refresh();
11786  }
11787  static \u0275fac = function PinterestTitleComponent_Factory(__ngFactoryType__) {
11788    return new (__ngFactoryType__ || _PinterestTitleComponent)();
11789  };
11790  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _PinterestTitleComponent, selectors: [["app-pinterest-title"]], decls: 17, vars: 20, consts: [["popover", ""], ["icon", "type", 1, "cursor-pointer", 3, "click", "variant", "severity", "tooltip", "tooltipPosition", "positionTop", "styleClass"], ["styleClass", "w-[22rem] -mt-5! no-gutter"], [1, "p-5", "flex", "flex-col", "gap-3"], [1, "font-semibold"], [1, "flex", "flex-col", "gap-1"], [3, "formControl", "placeholder"], [1, "text-grey-300", "text-sm", "text-right"], [1, "flex", "items-center", "justify-end", "gap-3"], ["label", "GLOBAL.CANCEL", "severity", "contrast", 3, "click"], ["label", "GLOBAL.CONFIRM", "severity", "secondary", 3, "click", "disabled"]], template: function PinterestTitleComponent_Template(rf, ctx) {
11791    if (rf & 1) {
11792      const _r1 = \u0275\u0275getCurrentView();
11793      \u0275\u0275elementStart(0, "ui-button", 1);
11794      \u0275\u0275pipe(1, "translate");
11795      \u0275\u0275listener("click", function PinterestTitleComponent_Template_ui_button_click_0_listener($event) {
11796        \u0275\u0275restoreView(_r1);
11797        const popover_r2 = \u0275\u0275reference(3);
11798        return \u0275\u0275resetView(popover_r2.toggle($event));
11799      });
11800      \u0275\u0275elementEnd();
11801      \u0275\u0275elementStart(2, "ui-popover", 2, 0)(4, "article", 3)(5, "header")(6, "h3", 4);
11802      \u0275\u0275text(7);
11803      \u0275\u0275pipe(8, "translate");
11804      \u0275\u0275elementEnd()();
11805      \u0275\u0275elementStart(9, "section", 5);
11806      \u0275\u0275element(10, "ui-input-text", 6);
11807      \u0275\u0275pipe(11, "translate");
11808      \u0275\u0275elementStart(12, "span", 7);
11809      \u0275\u0275text(13);
11810      \u0275\u0275elementEnd()();
11811      \u0275\u0275elementStart(14, "footer", 8)(15, "ui-button", 9);
11812      \u0275\u0275listener("click", function PinterestTitleComponent_Template_ui_button_click_15_listener() {
11813        \u0275\u0275restoreView(_r1);
11814        const popover_r2 = \u0275\u0275reference(3);
11815        return \u0275\u0275resetView(popover_r2.hide());
11816      });
11817      \u0275\u0275elementEnd();
11818      \u0275\u0275elementStart(16, "ui-button", 10);
11819      \u0275\u0275listener("click", function PinterestTitleComponent_Template_ui_button_click_16_listener() {
11820        \u0275\u0275restoreView(_r1);
11821        const popover_r2 = \u0275\u0275reference(3);
11822        ctx.confirm();
11823        return \u0275\u0275resetView(popover_r2.hide());
11824      });
11825      \u0275\u0275elementEnd()()()();
11826    }
11827    if (rf & 2) {
11828      const popover_r2 = \u0275\u0275reference(3);
11829      const hasTitle_r3 = ctx.store.post().options.pinterest.has.title;
11830      \u0275\u0275property("styleClass", \u0275\u0275interpolate2("", popover_r2.isOpen() && "bg-grey-50!", " ", hasTitle_r3 && "bg-secondary-50!"))("variant", hasTitle_r3 ? "outlined" : void 0)("severity", hasTitle_r3 ? "secondary" : "contrast")("tooltip", \u0275\u0275pipeBind1(1, 14, "MESSENGER.PINTEREST.TITLE"))("tooltipPosition", "top")("positionTop", -10);
11831      \u0275\u0275advance(7);
11832      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(8, 16, "MESSENGER.PINTEREST.TITLE"));
11833      \u0275\u0275advance(3);
11834      \u0275\u0275property("formControl", ctx.control)("placeholder", \u0275\u0275pipeBind1(11, 18, "MESSENGER.PINTEREST.TITLE_PLACEHOLDER"));
11835      \u0275\u0275advance(3);
11836      \u0275\u0275textInterpolate2("", (ctx.control.value == null ? null : ctx.control.value.length) || 0, "/", ctx.MAX_LENGTH);
11837      \u0275\u0275advance(3);
11838      \u0275\u0275property("disabled", ctx.control.invalid);
11839    }
11840  }, dependencies: [
11841    CommonModule,
11842    ReactiveFormsModule,
11843    NgControlStatus,
11844    FormControlDirective,
11845    TranslatePipe,
11846    PopoverComponent,
11847    ButtonComponent,
11848    InputTextComponent,
11849    TooltipDirective
11850  ], encapsulation: 2 });
11851};
11852(() => {
11853  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PinterestTitleComponent, [{
11854    type: Component,
11855    args: [{ selector: "app-pinterest-title", imports: [
11856      CommonModule,
11857      ReactiveFormsModule,
11858      TranslatePipe,
11859      PopoverComponent,
11860      ButtonComponent,
11861      InputTextComponent,
11862      TooltipDirective
11863    ], template: `@let hasTitle = store.post().options.pinterest.has.title;
11864
11865<ui-button
11866  (click)="popover.toggle($event)"
11867  icon="type"
11868  [variant]="hasTitle ? 'outlined' : undefined"
11869  [severity]="hasTitle ? 'secondary' : 'contrast'"
11870  [tooltip]="'MESSENGER.PINTEREST.TITLE' | translate"
11871  [tooltipPosition]="'top'"
11872  [positionTop]="-10"
11873  class="cursor-pointer"
11874  styleClass="{{ popover.isOpen() && 'bg-grey-50!' }} {{ hasTitle && 'bg-secondary-50!' }}"
11875/>
11876
11877<ui-popover #popover styleClass="w-[22rem] -mt-5! no-gutter">
11878  <article class="p-5 flex flex-col gap-3">
11879    <header>
11880      <h3 class="font-semibold">{{ 'MESSENGER.PINTEREST.TITLE' | translate }}</h3>
11881    </header>
11882
11883    <section class="flex flex-col gap-1">
11884      <ui-input-text [formControl]="control" [placeholder]="'MESSENGER.PINTEREST.TITLE_PLACEHOLDER' | translate" />
11885      <span class="text-grey-300 text-sm text-right">{{ control.value?.length || 0 }}/{{ MAX_LENGTH }}</span>
11886    </section>
11887
11888    <footer class="flex items-center justify-end gap-3">
11889      <ui-button (click)="popover.hide()" label="GLOBAL.CANCEL" severity="contrast" />
11890      <ui-button
11891        (click)="confirm(); popover.hide()"
11892        label="GLOBAL.CONFIRM"
11893        [disabled]="control.invalid"
11894        severity="secondary"
11895      />
11896    </footer>
11897  </article>
11898</ui-popover>
11899` }]
11900  }], null, null);
11901})();
11902(() => {
11903  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(PinterestTitleComponent, { className: "PinterestTitleComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/pinterest/components/title/title.component.ts", lineNumber: 21 });
11904})();
11905
11906// libs/socialgest/messenger/src/presenter/components/extras/pinterest/components/alt-text/alt-text.component.ts
11907var PinterestAltTextComponent = class _PinterestAltTextComponent {
11908  MAX_LENGTH = 500;
11909  store = inject(MessengerStore);
11910  control = new FormControl("", [Validators.maxLength(this.MAX_LENGTH)]);
11911  ngOnInit() {
11912    this.control.setValue(this.store.post().options.pinterest.altText);
11913  }
11914  confirm() {
11915    if (this.control.invalid)
11916      return;
11917    this.store.post().options.pinterest.set.altText(this.control.value);
11918    this.store.refresh();
11919  }
11920  static \u0275fac = function PinterestAltTextComponent_Factory(__ngFactoryType__) {
11921    return new (__ngFactoryType__ || _PinterestAltTextComponent)();
11922  };
11923  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _PinterestAltTextComponent, selectors: [["app-pinterest-alt-text"]], decls: 18, vars: 20, consts: [["popover", ""], ["icon", "alignJustify", 1, "cursor-pointer", 3, "click", "variant", "severity", "tooltip", "tooltipPosition", "positionTop", "styleClass"], ["styleClass", "w-[22rem] -mt-5! no-gutter"], [1, "h-[21rem]", "grid", "grid-rows-[auto_1fr_auto]", "p-5", "gap-2"], [1, "font-semibold"], [1, "size-full", "relative"], ["styleClass", "size-full rounded-base", 3, "formControl", "placeholder"], [1, "absolute", "bottom-2", "right-2"], [1, "text-grey-300", "text-sm", "font-sans", "md:ml-4"], [1, "flex", "items-center", "justify-end", "gap-3", "mt-2"], ["label", "GLOBAL.CANCEL", "severity", "contrast", 3, "click"], ["label", "GLOBAL.CONFIRM", "severity", "secondary", 3, "click", "disabled"]], template: function PinterestAltTextComponent_Template(rf, ctx) {
11924    if (rf & 1) {
11925      const _r1 = \u0275\u0275getCurrentView();
11926      \u0275\u0275elementStart(0, "ui-button", 1);
11927      \u0275\u0275pipe(1, "translate");
11928      \u0275\u0275listener("click", function PinterestAltTextComponent_Template_ui_button_click_0_listener($event) {
11929        \u0275\u0275restoreView(_r1);
11930        const popover_r2 = \u0275\u0275reference(3);
11931        return \u0275\u0275resetView(popover_r2.toggle($event));
11932      });
11933      \u0275\u0275elementEnd();
11934      \u0275\u0275elementStart(2, "ui-popover", 2, 0)(4, "article", 3)(5, "header")(6, "h3", 4);
11935      \u0275\u0275text(7);
11936      \u0275\u0275pipe(8, "translate");
11937      \u0275\u0275elementEnd()();
11938      \u0275\u0275elementStart(9, "section", 5);
11939      \u0275\u0275element(10, "ui-textarea", 6);
11940      \u0275\u0275pipe(11, "translate");
11941      \u0275\u0275elementStart(12, "footer", 7)(13, "span", 8);
11942      \u0275\u0275text(14);
11943      \u0275\u0275elementEnd()()();
11944      \u0275\u0275elementStart(15, "footer", 9)(16, "ui-button", 10);
11945      \u0275\u0275listener("click", function PinterestAltTextComponent_Template_ui_button_click_16_listener() {
11946        \u0275\u0275restoreView(_r1);
11947        const popover_r2 = \u0275\u0275reference(3);
11948        return \u0275\u0275resetView(popover_r2.hide());
11949      });
11950      \u0275\u0275elementEnd();
11951      \u0275\u0275elementStart(17, "ui-button", 11);
11952      \u0275\u0275listener("click", function PinterestAltTextComponent_Template_ui_button_click_17_listener() {
11953        \u0275\u0275restoreView(_r1);
11954        const popover_r2 = \u0275\u0275reference(3);
11955        ctx.confirm();
11956        return \u0275\u0275resetView(popover_r2.hide());
11957      });
11958      \u0275\u0275elementEnd()()()();
11959    }
11960    if (rf & 2) {
11961      const popover_r2 = \u0275\u0275reference(3);
11962      const hasAltText_r3 = ctx.store.post().options.pinterest.has.altText;
11963      \u0275\u0275property("styleClass", \u0275\u0275interpolate2("", popover_r2.isOpen() && "bg-grey-50!", " ", hasAltText_r3 && "bg-secondary-50!"))("variant", hasAltText_r3 ? "outlined" : void 0)("severity", hasAltText_r3 ? "secondary" : "contrast")("tooltip", \u0275\u0275pipeBind1(1, 14, "MESSENGER.PINTEREST.ALT_TEXT"))("tooltipPosition", "top")("positionTop", -10);
11964      \u0275\u0275advance(7);
11965      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(8, 16, "MESSENGER.PINTEREST.ALT_TEXT"));
11966      \u0275\u0275advance(3);
11967      \u0275\u0275property("formControl", ctx.control)("placeholder", \u0275\u0275pipeBind1(11, 18, "MESSENGER.PINTEREST.ALT_TEXT_PLACEHOLDER"));
11968      \u0275\u0275advance(4);
11969      \u0275\u0275textInterpolate2("", (ctx.control.value == null ? null : ctx.control.value.length) || 0, "/", ctx.MAX_LENGTH);
11970      \u0275\u0275advance(3);
11971      \u0275\u0275property("disabled", ctx.control.invalid);
11972    }
11973  }, dependencies: [
11974    CommonModule,
11975    ReactiveFormsModule,
11976    NgControlStatus,
11977    FormControlDirective,
11978    TranslatePipe,
11979    PopoverComponent,
11980    ButtonComponent,
11981    TextareaComponent,
11982    TooltipDirective
11983  ], encapsulation: 2 });
11984};
11985(() => {
11986  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PinterestAltTextComponent, [{
11987    type: Component,
11988    args: [{ selector: "app-pinterest-alt-text", imports: [
11989      CommonModule,
11990      ReactiveFormsModule,
11991      TranslatePipe,
11992      PopoverComponent,
11993      ButtonComponent,
11994      TextareaComponent,
11995      TooltipDirective
11996    ], template: `@let hasAltText = store.post().options.pinterest.has.altText;
11997
11998<ui-button
11999  (click)="popover.toggle($event)"
12000  icon="alignJustify"
12001  [variant]="hasAltText ? 'outlined' : undefined"
12002  [severity]="hasAltText ? 'secondary' : 'contrast'"
12003  [tooltip]="'MESSENGER.PINTEREST.ALT_TEXT' | translate"
12004  [tooltipPosition]="'top'"
12005  [positionTop]="-10"
12006  class="cursor-pointer"
12007  styleClass="{{ popover.isOpen() && 'bg-grey-50!' }} {{ hasAltText && 'bg-secondary-50!' }}"
12008/>
12009
12010<ui-popover #popover styleClass="w-[22rem] -mt-5! no-gutter">
12011  <article class="h-[21rem] grid grid-rows-[auto_1fr_auto] p-5 gap-2">
12012    <header>
12013      <h3 class="font-semibold">{{ 'MESSENGER.PINTEREST.ALT_TEXT' | translate }}</h3>
12014    </header>
12015
12016    <section class="size-full relative">
12017      <ui-textarea
12018        [formControl]="control"
12019        [placeholder]="'MESSENGER.PINTEREST.ALT_TEXT_PLACEHOLDER' | translate"
12020        styleClass="size-full rounded-base"
12021      />
12022
12023      <footer class="absolute bottom-2 right-2">
12024        <span class="text-grey-300 text-sm font-sans md:ml-4">{{ control.value?.length || 0 }}/{{ MAX_LENGTH }}</span>
12025      </footer>
12026    </section>
12027
12028    <footer class="flex items-center justify-end gap-3 mt-2">
12029      <ui-button (click)="popover.hide()" label="GLOBAL.CANCEL" severity="contrast" />
12030      <ui-button
12031        (click)="confirm(); popover.hide()"
12032        label="GLOBAL.CONFIRM"
12033        [disabled]="control.invalid"
12034        severity="secondary"
12035      />
12036    </footer>
12037  </article>
12038</ui-popover>
12039` }]
12040  }], null, null);
12041})();
12042(() => {
12043  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(PinterestAltTextComponent, { className: "PinterestAltTextComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/pinterest/components/alt-text/alt-text.component.ts", lineNumber: 21 });
12044})();
12045
12046// libs/socialgest/messenger/src/presenter/components/extras/pinterest/components/board/board.component.ts
12047function PinterestBoardComponent_Conditional_11_Template(rf, ctx) {
12048  if (rf & 1) {
12049    const _r3 = \u0275\u0275getCurrentView();
12050    \u0275\u0275elementStart(0, "div", 6)(1, "ui-input-text", 8);
12051    \u0275\u0275pipe(2, "translate");
12052    \u0275\u0275listener("ngModelChange", function PinterestBoardComponent_Conditional_11_Template_ui_input_text_ngModelChange_1_listener($event) {
12053      \u0275\u0275restoreView(_r3);
12054      const ctx_r3 = \u0275\u0275nextContext();
12055      return \u0275\u0275resetView(ctx_r3.newBoardName.set($event));
12056    });
12057    \u0275\u0275elementEnd();
12058    \u0275\u0275elementStart(3, "ui-button", 9);
12059    \u0275\u0275listener("click", function PinterestBoardComponent_Conditional_11_Template_ui_button_click_3_listener() {
12060      \u0275\u0275restoreView(_r3);
12061      const ctx_r3 = \u0275\u0275nextContext();
12062      return \u0275\u0275resetView(ctx_r3.createBoard());
12063    });
12064    \u0275\u0275elementEnd()();
12065  }
12066  if (rf & 2) {
12067    const ctx_r3 = \u0275\u0275nextContext();
12068    \u0275\u0275advance();
12069    \u0275\u0275property("ngModel", ctx_r3.newBoardName())("placeholder", \u0275\u0275pipeBind1(2, 3, "MESSENGER.PINTEREST.BOARD"));
12070    \u0275\u0275advance(2);
12071    \u0275\u0275property("disabled", !ctx_r3.newBoardName().trim() || ctx_r3.isCreating());
12072  }
12073}
12074var PinterestBoardComponent = class _PinterestBoardComponent {
12075  store = inject(MessengerStore);
12076  boardsService = inject(PinterestBoardsService);
12077  boards = signal([]);
12078  isLoading = signal(false);
12079  isCreating = signal(false);
12080  showCreateForm = signal(false);
12081  newBoardName = signal("");
12082  boardOptions = computed(() => this.boards().map((b) => ({ label: b.name, value: b.id })));
12083  boardId = computed(() => this.store.post().options.pinterest.boardId);
12084  hasBoard = computed(() => this.store.post().options.pinterest.has.board);
12085  ngOnInit() {
12086    this.loadBoards();
12087  }
12088  onBoardChange(value) {
12089    this.store.post().options.pinterest.set.boardId(value);
12090    this.store.refresh();
12091  }
12092  toggleCreateForm() {
12093    this.showCreateForm.update((v) => !v);
12094    this.newBoardName.set("");
12095  }
12096  createBoard() {
12097    const name = this.newBoardName();
12098    if (!name.trim())
12099      return;
12100    const user = this.store.post().userList.pinterest.first;
12101    if (!user)
12102      return;
12103    this.isCreating.set(true);
12104    this.boardsService.create(user.id, name).subscribe((success) => {
12105      this.isCreating.set(false);
12106      if (success) {
12107        this.showCreateForm.set(false);
12108        this.newBoardName.set("");
12109        this.loadBoards();
12110      }
12111    });
12112  }
12113  loadBoards() {
12114    const user = this.store.post().userList.pinterest.first;
12115    if (!user)
12116      return;
12117    this.isLoading.set(true);
12118    this.boardsService.list(user.id).subscribe((boards) => {
12119      this.boards.set(boards);
12120      this.isLoading.set(false);
12121    });
12122  }
12123  static \u0275fac = function PinterestBoardComponent_Factory(__ngFactoryType__) {
12124    return new (__ngFactoryType__ || _PinterestBoardComponent)();
12125  };
12126  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _PinterestBoardComponent, selectors: [["app-pinterest-board"]], decls: 14, vars: 22, consts: [["popover", ""], ["icon", "tag", 1, "cursor-pointer", 3, "click", "variant", "severity", "tooltip", "tooltipPosition", "positionTop", "styleClass"], ["styleClass", "w-[22rem] h-64 -mt-5! no-gutter"], [1, "p-5", "flex", "flex-col", "gap-3"], [1, "font-semibold"], ["optionLabel", "label", "optionValue", "value", 3, "ngModelChange", "options", "ngModel", "placeholder", "disabled", "clearable"], [1, "flex", "gap-2"], ["severity", "contrast", "styleClass", "w-full", 3, "click", "label"], [1, "flex-1", 3, "ngModelChange", "ngModel", "placeholder"], ["label", "GLOBAL.CONFIRM", "severity", "secondary", 3, "click", "disabled"]], template: function PinterestBoardComponent_Template(rf, ctx) {
12127    if (rf & 1) {
12128      const _r1 = \u0275\u0275getCurrentView();
12129      \u0275\u0275elementStart(0, "ui-button", 1);
12130      \u0275\u0275pipe(1, "translate");
12131      \u0275\u0275listener("click", function PinterestBoardComponent_Template_ui_button_click_0_listener($event) {
12132        \u0275\u0275restoreView(_r1);
12133        const popover_r2 = \u0275\u0275reference(3);
12134        return \u0275\u0275resetView(popover_r2.toggle($event));
12135      });
12136      \u0275\u0275elementEnd();
12137      \u0275\u0275elementStart(2, "ui-popover", 2, 0)(4, "article", 3)(5, "header")(6, "h3", 4);
12138      \u0275\u0275text(7);
12139      \u0275\u0275pipe(8, "translate");
12140      \u0275\u0275elementEnd()();
12141      \u0275\u0275elementStart(9, "ui-select", 5);
12142      \u0275\u0275pipe(10, "translate");
12143      \u0275\u0275listener("ngModelChange", function PinterestBoardComponent_Template_ui_select_ngModelChange_9_listener($event) {
12144        \u0275\u0275restoreView(_r1);
12145        return \u0275\u0275resetView(ctx.onBoardChange($event));
12146      });
12147      \u0275\u0275elementEnd();
12148      \u0275\u0275conditionalCreate(11, PinterestBoardComponent_Conditional_11_Template, 4, 5, "div", 6);
12149      \u0275\u0275elementStart(12, "footer")(13, "ui-button", 7);
12150      \u0275\u0275listener("click", function PinterestBoardComponent_Template_ui_button_click_13_listener() {
12151        \u0275\u0275restoreView(_r1);
12152        return \u0275\u0275resetView(ctx.toggleCreateForm());
12153      });
12154      \u0275\u0275elementEnd()()()();
12155    }
12156    if (rf & 2) {
12157      const popover_r2 = \u0275\u0275reference(3);
12158      const hasBoardSelected_r5 = ctx.hasBoard();
12159      \u0275\u0275property("styleClass", \u0275\u0275interpolate2("", popover_r2.isOpen() && "bg-grey-50!", " ", hasBoardSelected_r5 && "bg-secondary-50!"))("variant", hasBoardSelected_r5 ? "outlined" : void 0)("severity", hasBoardSelected_r5 ? "secondary" : "contrast")("tooltip", \u0275\u0275pipeBind1(1, 16, "MESSENGER.PINTEREST.BOARD"))("tooltipPosition", "top")("positionTop", -10);
12160      \u0275\u0275advance(7);
12161      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(8, 18, "MESSENGER.PINTEREST.BOARD"));
12162      \u0275\u0275advance(2);
12163      \u0275\u0275property("options", ctx.boardOptions())("ngModel", ctx.boardId())("placeholder", \u0275\u0275pipeBind1(10, 20, "MESSENGER.PINTEREST.SELECT_BOARD"))("disabled", ctx.isLoading())("clearable", true);
12164      \u0275\u0275advance(2);
12165      \u0275\u0275conditional(ctx.showCreateForm() ? 11 : -1);
12166      \u0275\u0275advance(2);
12167      \u0275\u0275property("label", "MESSENGER.PINTEREST.NEW_BOARD");
12168    }
12169  }, dependencies: [
12170    CommonModule,
12171    FormsModule,
12172    NgControlStatus,
12173    NgModel,
12174    TranslatePipe,
12175    PopoverComponent,
12176    ButtonComponent,
12177    SelectComponent,
12178    InputTextComponent,
12179    TooltipDirective
12180  ], encapsulation: 2 });
12181};
12182(() => {
12183  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PinterestBoardComponent, [{
12184    type: Component,
12185    args: [{ selector: "app-pinterest-board", imports: [
12186      CommonModule,
12187      FormsModule,
12188      TranslatePipe,
12189      PopoverComponent,
12190      ButtonComponent,
12191      SelectComponent,
12192      InputTextComponent,
12193      TooltipDirective
12194    ], template: `@let hasBoardSelected = hasBoard();
12195
12196<ui-button
12197  (click)="popover.toggle($event)"
12198  icon="tag"
12199  [variant]="hasBoardSelected ? 'outlined' : undefined"
12200  [severity]="hasBoardSelected ? 'secondary' : 'contrast'"
12201  [tooltip]="'MESSENGER.PINTEREST.BOARD' | translate"
12202  [tooltipPosition]="'top'"
12203  [positionTop]="-10"
12204  class="cursor-pointer"
12205  styleClass="{{ popover.isOpen() && 'bg-grey-50!' }} {{ hasBoardSelected && 'bg-secondary-50!' }}"
12206/>
12207
12208<ui-popover #popover styleClass="w-[22rem] h-64 -mt-5! no-gutter">
12209  <article class="p-5 flex flex-col gap-3">
12210    <header>
12211      <h3 class="font-semibold">{{ 'MESSENGER.PINTEREST.BOARD' | translate }}</h3>
12212    </header>
12213
12214    <ui-select
12215      [options]="boardOptions()"
12216      [ngModel]="boardId()"
12217      (ngModelChange)="onBoardChange($event)"
12218      optionLabel="label"
12219      optionValue="value"
12220      [placeholder]="'MESSENGER.PINTEREST.SELECT_BOARD' | translate"
12221      [disabled]="isLoading()"
12222      [clearable]="true"
12223    />
12224
12225    @if (showCreateForm()) {
12226    <div class="flex gap-2">
12227      <ui-input-text
12228        [ngModel]="newBoardName()"
12229        (ngModelChange)="newBoardName.set($event)"
12230        [placeholder]="'MESSENGER.PINTEREST.BOARD' | translate"
12231        class="flex-1"
12232      />
12233      <ui-button
12234        (click)="createBoard()"
12235        label="GLOBAL.CONFIRM"
12236        severity="secondary"
12237        [disabled]="!newBoardName().trim() || isCreating()"
12238      />
12239    </div>
12240    }
12241
12242    <footer>
12243      <ui-button
12244        (click)="toggleCreateForm()"
12245        [label]="'MESSENGER.PINTEREST.NEW_BOARD'"
12246        severity="contrast"
12247        styleClass="w-full"
12248      />
12249    </footer>
12250  </article>
12251</ui-popover>
12252` }]
12253  }], null, null);
12254})();
12255(() => {
12256  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(PinterestBoardComponent, { className: "PinterestBoardComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/pinterest/components/board/board.component.ts", lineNumber: 22 });
12257})();
12258
12259// libs/socialgest/messenger/src/presenter/components/extras/pinterest/pinterest.component.ts
12260var PinterestComponent = class _PinterestComponent {
12261  store = inject(MessengerStore);
12262  onDestLinkChange(value) {
12263    this.store.post().options.pinterest.set.destLink(value);
12264    this.store.refresh();
12265  }
12266  static \u0275fac = function PinterestComponent_Factory(__ngFactoryType__) {
12267    return new (__ngFactoryType__ || _PinterestComponent)();
12268  };
12269  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _PinterestComponent, selectors: [["app-pinterest"]], decls: 16, vars: 10, consts: [[1, "flex", "gap-12"], [1, "flex-1", "flex", "flex-col", "gap-1"], [1, "text-sm", "font-bold", "text-grey-500"], [3, "ngModelChange", "ngModel", "placeholder"], [1, "flex", "flex-col", "gap-1.5"], [1, "text-sm", "font-semibold"], [1, "flex", "gap-4"]], template: function PinterestComponent_Template(rf, ctx) {
12270    if (rf & 1) {
12271      \u0275\u0275elementStart(0, "section", 0)(1, "div", 1)(2, "span", 2);
12272      \u0275\u0275text(3);
12273      \u0275\u0275pipe(4, "translate");
12274      \u0275\u0275elementEnd();
12275      \u0275\u0275elementStart(5, "ui-input-text", 3);
12276      \u0275\u0275pipe(6, "translate");
12277      \u0275\u0275listener("ngModelChange", function PinterestComponent_Template_ui_input_text_ngModelChange_5_listener($event) {
12278        return ctx.onDestLinkChange($event);
12279      });
12280      \u0275\u0275elementEnd()();
12281      \u0275\u0275elementStart(7, "div", 4)(8, "h3", 5);
12282      \u0275\u0275text(9);
12283      \u0275\u0275pipe(10, "translate");
12284      \u0275\u0275elementEnd();
12285      \u0275\u0275elementStart(11, "div", 6);
12286      \u0275\u0275element(12, "app-pinterest-title")(13, "app-pinterest-alt-text")(14, "app-pinterest-board")(15, "app-url-shortener");
12287      \u0275\u0275elementEnd()()();
12288    }
12289    if (rf & 2) {
12290      \u0275\u0275advance(3);
12291      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 4, "MESSENGER.PINTEREST.DEST_LINK"));
12292      \u0275\u0275advance(2);
12293      \u0275\u0275property("ngModel", ctx.store.post().options.pinterest.destLink)("placeholder", \u0275\u0275pipeBind1(6, 6, "MESSENGER.PINTEREST.DEST_LINK_PLACEHOLDER"));
12294      \u0275\u0275advance(4);
12295      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(10, 8, "MESSENGER.EXTRAS"));
12296    }
12297  }, dependencies: [
12298    CommonModule,
12299    FormsModule,
12300    NgControlStatus,
12301    NgModel,
12302    TranslatePipe,
12303    InputTextComponent,
12304    PinterestTitleComponent,
12305    PinterestAltTextComponent,
12306    PinterestBoardComponent,
12307    UrlShortenerComponent
12308  ], encapsulation: 2 });
12309};
12310(() => {
12311  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PinterestComponent, [{
12312    type: Component,
12313    args: [{ selector: "app-pinterest", imports: [
12314      CommonModule,
12315      FormsModule,
12316      TranslatePipe,
12317      InputTextComponent,
12318      PinterestTitleComponent,
12319      PinterestAltTextComponent,
12320      PinterestBoardComponent,
12321      UrlShortenerComponent
12322    ], template: `<section class="flex gap-12">
12323  <div class="flex-1 flex flex-col gap-1">
12324    <span class="text-sm font-bold text-grey-500">{{ 'MESSENGER.PINTEREST.DEST_LINK' | translate }}</span>
12325    <ui-input-text
12326      [ngModel]="store.post().options.pinterest.destLink"
12327      (ngModelChange)="onDestLinkChange($event)"
12328      [placeholder]="'MESSENGER.PINTEREST.DEST_LINK_PLACEHOLDER' | translate"
12329    />
12330  </div>
12331
12332  <div class="flex flex-col gap-1.5">
12333    <h3 class="text-sm font-semibold">{{ 'MESSENGER.EXTRAS' | translate }}</h3>
12334
12335    <div class="flex gap-4">
12336      <app-pinterest-title />
12337      <app-pinterest-alt-text />
12338      <app-pinterest-board />
12339      <app-url-shortener />
12340    </div>
12341  </div>
12342</section>
12343` }]
12344  }], null, null);
12345})();
12346(() => {
12347  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(PinterestComponent, { className: "PinterestComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/pinterest/pinterest.component.ts", lineNumber: 26 });
12348})();
12349
12350// libs/socialgest/messenger/src/presenter/components/extras/threads/threads-extras.component.ts
12351var ThreadsExtrasComponent = class _ThreadsExtrasComponent {
12352  store = inject(MessengerStore);
12353  isThreadActive = computed(() => this.store.thread().threads.active);
12354  toggleThread() {
12355    if (this.isThreadActive()) {
12356      this.store.disableThread(UserType.THREADS);
12357    } else {
12358      this.store.post().threadPosts.insert();
12359      this.store.enableThread(UserType.THREADS);
12360      this.store.refresh();
12361    }
12362  }
12363  static \u0275fac = function ThreadsExtrasComponent_Factory(__ngFactoryType__) {
12364    return new (__ngFactoryType__ || _ThreadsExtrasComponent)();
12365  };
12366  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _ThreadsExtrasComponent, selectors: [["app-threads-extras"]], decls: 9, vars: 12, consts: [[1, "flex", "gap-12"], [1, "flex", "flex-col", "gap-2.5"], [1, "text-sm", "font-semibold"], [1, "flex", "gap-4"], ["icon", "listTree", 1, "cursor-pointer", 3, "click", "variant", "severity", "tooltip", "tooltipPosition", "positionTop", "styleClass"]], template: function ThreadsExtrasComponent_Template(rf, ctx) {
12367    if (rf & 1) {
12368      \u0275\u0275elementStart(0, "section", 0)(1, "div", 1)(2, "h3", 2);
12369      \u0275\u0275text(3);
12370      \u0275\u0275pipe(4, "translate");
12371      \u0275\u0275elementEnd();
12372      \u0275\u0275elementStart(5, "div", 3)(6, "ui-button", 4);
12373      \u0275\u0275pipe(7, "translate");
12374      \u0275\u0275listener("click", function ThreadsExtrasComponent_Template_ui_button_click_6_listener() {
12375        return ctx.toggleThread();
12376      });
12377      \u0275\u0275elementEnd();
12378      \u0275\u0275element(8, "app-url-shortener");
12379      \u0275\u0275elementEnd()()();
12380    }
12381    if (rf & 2) {
12382      \u0275\u0275advance(3);
12383      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 8, "MESSENGER.EXTRAS"));
12384      \u0275\u0275advance(3);
12385      \u0275\u0275property("styleClass", \u0275\u0275interpolate(ctx.isThreadActive() && "bg-secondary-50!"))("variant", ctx.isThreadActive() ? "outlined" : void 0)("severity", ctx.isThreadActive() ? "secondary" : "contrast")("tooltip", \u0275\u0275pipeBind1(7, 10, "MESSENGER.THREAD.TOGGLE"))("tooltipPosition", "top")("positionTop", -10);
12386    }
12387  }, dependencies: [TranslatePipe, ButtonComponent, TooltipDirective, UrlShortenerComponent], encapsulation: 2 });
12388};
12389(() => {
12390  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ThreadsExtrasComponent, [{
12391    type: Component,
12392    args: [{ selector: "app-threads-extras", imports: [TranslatePipe, ButtonComponent, TooltipDirective, UrlShortenerComponent], template: `<section class="flex gap-12">
12393  <div class="flex flex-col gap-2.5">
12394    <h3 class="text-sm font-semibold">{{ 'MESSENGER.EXTRAS' | translate }}</h3>
12395
12396    <div class="flex gap-4">
12397      <ui-button
12398        (click)="toggleThread()"
12399        icon="listTree"
12400        [variant]="isThreadActive() ? 'outlined' : undefined"
12401        [severity]="isThreadActive() ? 'secondary' : 'contrast'"
12402        [tooltip]="'MESSENGER.THREAD.TOGGLE' | translate"
12403        [tooltipPosition]="'top'"
12404        [positionTop]="-10"
12405        class="cursor-pointer"
12406        styleClass="{{ isThreadActive() && 'bg-secondary-50!' }}"
12407      />
12408      <app-url-shortener />
12409    </div>
12410  </div>
12411</section>
12412` }]
12413  }], null, null);
12414})();
12415(() => {
12416  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(ThreadsExtrasComponent, { className: "ThreadsExtrasComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/threads/threads-extras.component.ts", lineNumber: 12 });
12417})();
12418
12419// libs/socialgest/messenger/src/presenter/components/extras/x/x.component.ts
12420var XExtrasComponent = class _XExtrasComponent {
12421  store = inject(MessengerStore);
12422  isThreadActive = computed(() => this.store.thread().x.active);
12423  toggleThread() {
12424    if (this.isThreadActive()) {
12425      this.store.disableThread(UserType.X);
12426    } else {
12427      this.store.post().threadPosts.insert();
12428      this.store.enableThread(UserType.X);
12429      this.store.refresh();
12430    }
12431  }
12432  static \u0275fac = function XExtrasComponent_Factory(__ngFactoryType__) {
12433    return new (__ngFactoryType__ || _XExtrasComponent)();
12434  };
12435  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _XExtrasComponent, selectors: [["app-x-extras"]], decls: 9, vars: 12, consts: [[1, "flex", "gap-12"], [1, "flex", "flex-col", "gap-2.5"], [1, "text-sm", "font-semibold"], [1, "flex", "gap-4"], ["icon", "listTree", 1, "cursor-pointer", 3, "click", "variant", "severity", "tooltip", "tooltipPosition", "positionTop", "styleClass"]], template: function XExtrasComponent_Template(rf, ctx) {
12436    if (rf & 1) {
12437      \u0275\u0275elementStart(0, "section", 0)(1, "div", 1)(2, "h3", 2);
12438      \u0275\u0275text(3);
12439      \u0275\u0275pipe(4, "translate");
12440      \u0275\u0275elementEnd();
12441      \u0275\u0275elementStart(5, "div", 3)(6, "ui-button", 4);
12442      \u0275\u0275pipe(7, "translate");
12443      \u0275\u0275listener("click", function XExtrasComponent_Template_ui_button_click_6_listener() {
12444        return ctx.toggleThread();
12445      });
12446      \u0275\u0275elementEnd();
12447      \u0275\u0275element(8, "app-url-shortener");
12448      \u0275\u0275elementEnd()()();
12449    }
12450    if (rf & 2) {
12451      \u0275\u0275advance(3);
12452      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 8, "MESSENGER.EXTRAS"));
12453      \u0275\u0275advance(3);
12454      \u0275\u0275property("styleClass", \u0275\u0275interpolate(ctx.isThreadActive() && "bg-secondary-50!"))("variant", ctx.isThreadActive() ? "outlined" : void 0)("severity", ctx.isThreadActive() ? "secondary" : "contrast")("tooltip", \u0275\u0275pipeBind1(7, 10, "MESSENGER.THREAD.TOGGLE"))("tooltipPosition", "top")("positionTop", -10);
12455    }
12456  }, dependencies: [TranslatePipe, ButtonComponent, TooltipDirective, UrlShortenerComponent], encapsulation: 2 });
12457};
12458(() => {
12459  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(XExtrasComponent, [{
12460    type: Component,
12461    args: [{ selector: "app-x-extras", imports: [TranslatePipe, ButtonComponent, TooltipDirective, UrlShortenerComponent], template: `<section class="flex gap-12">
12462  <div class="flex flex-col gap-2.5">
12463    <h3 class="text-sm font-semibold">{{ 'MESSENGER.EXTRAS' | translate }}</h3>
12464
12465    <div class="flex gap-4">
12466      <ui-button
12467        (click)="toggleThread()"
12468        icon="listTree"
12469        [variant]="isThreadActive() ? 'outlined' : undefined"
12470        [severity]="isThreadActive() ? 'secondary' : 'contrast'"
12471        [tooltip]="'MESSENGER.THREAD.TOGGLE' | translate"
12472        [tooltipPosition]="'top'"
12473        [positionTop]="-10"
12474        class="cursor-pointer"
12475        styleClass="{{ isThreadActive() && 'bg-secondary-50!' }}"
12476      />
12477      <app-url-shortener />
12478    </div>
12479  </div>
12480</section>
12481` }]
12482  }], null, null);
12483})();
12484(() => {
12485  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(XExtrasComponent, { className: "XExtrasComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/x/x.component.ts", lineNumber: 12 });
12486})();
12487
12488// libs/socialgest/messenger/src/presenter/views/youtube/constants/youtube.constants.ts
12489var YOUTUBE_PUBLICATION_MODES = [
12490  { label: "MESSENGER.YOUTUBE.PUBLIC", value: "public" },
12491  { label: "MESSENGER.YOUTUBE.PRIVATE", value: "private" },
12492  { label: "MESSENGER.YOUTUBE.UNLISTED", value: "unlisted" }
12493];
12494
12495// libs/socialgest/messenger/src/presenter/components/extras/youtube/youtube-extras.component.ts
12496var YoutubeExtrasComponent = class _YoutubeExtrasComponent {
12497  store = inject(MessengerStore);
12498  categoriesService = inject(YouTubeCategoriesService);
12499  publicationModes = YOUTUBE_PUBLICATION_MODES;
12500  categories = signal([]);
12501  categoryOptions = computed(() => this.categories().map((c) => ({ label: c.snippet.title, value: c.id })));
12502  publicationMode = computed(() => this.store.post().options.youtube.publicationMode);
12503  category = computed(() => this.store.post().options.youtube.category);
12504  ngOnInit() {
12505    this.loadCategories();
12506  }
12507  onPublicationModeChange(value) {
12508    this.store.post().options.youtube.set.publicationMode(value);
12509    this.store.refresh();
12510  }
12511  onCategoryChange(value) {
12512    this.store.post().options.youtube.set.category(value);
12513    this.store.refresh();
12514  }
12515  loadCategories() {
12516    const youtubeUser = this.store.post().userList.youtube.first;
12517    if (!youtubeUser)
12518      return;
12519    this.categoriesService.list(youtubeUser.id).subscribe((categories) => this.categories.set(categories));
12520  }
12521  static \u0275fac = function YoutubeExtrasComponent_Factory(__ngFactoryType__) {
12522    return new (__ngFactoryType__ || _YoutubeExtrasComponent)();
12523  };
12524  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _YoutubeExtrasComponent, selectors: [["app-youtube-extras"]], decls: 18, vars: 18, consts: [[1, "flex", "gap-4"], [1, "flex-1", "flex", "flex-col", "gap-1"], [1, "text-sm", "font-bold", "text-grey-500"], ["optionLabel", "label", "optionValue", "value", 3, "ngModelChange", "options", "ngModel", "translateLabels"], ["optionLabel", "label", "optionValue", "value", 3, "ngModelChange", "options", "ngModel", "translateLabels", "placeholder"], [1, "flex", "flex-col", "gap-2.5"], [1, "text-sm", "font-semibold"]], template: function YoutubeExtrasComponent_Template(rf, ctx) {
12525    if (rf & 1) {
12526      \u0275\u0275elementStart(0, "section", 0)(1, "div", 1)(2, "span", 2);
12527      \u0275\u0275text(3);
12528      \u0275\u0275pipe(4, "translate");
12529      \u0275\u0275elementEnd();
12530      \u0275\u0275elementStart(5, "ui-select", 3);
12531      \u0275\u0275listener("ngModelChange", function YoutubeExtrasComponent_Template_ui_select_ngModelChange_5_listener($event) {
12532        return ctx.onPublicationModeChange($event);
12533      });
12534      \u0275\u0275elementEnd()();
12535      \u0275\u0275elementStart(6, "div", 1)(7, "span", 2);
12536      \u0275\u0275text(8);
12537      \u0275\u0275pipe(9, "translate");
12538      \u0275\u0275elementEnd();
12539      \u0275\u0275elementStart(10, "ui-select", 4);
12540      \u0275\u0275pipe(11, "translate");
12541      \u0275\u0275listener("ngModelChange", function YoutubeExtrasComponent_Template_ui_select_ngModelChange_10_listener($event) {
12542        return ctx.onCategoryChange($event);
12543      });
12544      \u0275\u0275elementEnd()();
12545      \u0275\u0275elementStart(12, "div", 5)(13, "h3", 6);
12546      \u0275\u0275text(14);
12547      \u0275\u0275pipe(15, "translate");
12548      \u0275\u0275elementEnd();
12549      \u0275\u0275elementStart(16, "div", 0);
12550      \u0275\u0275element(17, "app-url-shortener");
12551      \u0275\u0275elementEnd()()();
12552    }
12553    if (rf & 2) {
12554      \u0275\u0275advance(3);
12555      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 10, "MESSENGER.YOUTUBE.PRIVACY"));
12556      \u0275\u0275advance(2);
12557      \u0275\u0275property("options", ctx.publicationModes)("ngModel", ctx.publicationMode())("translateLabels", true);
12558      \u0275\u0275advance(3);
12559      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(9, 12, "MESSENGER.YOUTUBE.CATEGORY"));
12560      \u0275\u0275advance(2);
12561      \u0275\u0275property("options", ctx.categoryOptions())("ngModel", ctx.category())("translateLabels", false)("placeholder", \u0275\u0275pipeBind1(11, 14, "MESSENGER.YOUTUBE.SELECT_CATEGORY"));
12562      \u0275\u0275advance(4);
12563      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(15, 16, "MESSENGER.EXTRAS"));
12564    }
12565  }, dependencies: [CommonModule, FormsModule, NgControlStatus, NgModel, TranslatePipe, SelectComponent, UrlShortenerComponent], encapsulation: 2 });
12566};
12567(() => {
12568  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(YoutubeExtrasComponent, [{
12569    type: Component,
12570    args: [{ selector: "app-youtube-extras", imports: [CommonModule, FormsModule, TranslatePipe, SelectComponent, UrlShortenerComponent], template: `<section class="flex gap-4">
12571  <div class="flex-1 flex flex-col gap-1">
12572    <span class="text-sm font-bold text-grey-500">{{ 'MESSENGER.YOUTUBE.PRIVACY' | translate }}</span>
12573    <ui-select
12574      [options]="publicationModes"
12575      [ngModel]="publicationMode()"
12576      (ngModelChange)="onPublicationModeChange($event)"
12577      optionLabel="label"
12578      optionValue="value"
12579      [translateLabels]="true"
12580    />
12581  </div>
12582
12583  <div class="flex-1 flex flex-col gap-1">
12584    <span class="text-sm font-bold text-grey-500">{{ 'MESSENGER.YOUTUBE.CATEGORY' | translate }}</span>
12585    <ui-select
12586      [options]="categoryOptions()"
12587      [ngModel]="category()"
12588      (ngModelChange)="onCategoryChange($event)"
12589      optionLabel="label"
12590      optionValue="value"
12591      [translateLabels]="false"
12592      [placeholder]="'MESSENGER.YOUTUBE.SELECT_CATEGORY' | translate"
12593    />
12594  </div>
12595
12596  <div class="flex flex-col gap-2.5">
12597    <h3 class="text-sm font-semibold">{{ 'MESSENGER.EXTRAS' | translate }}</h3>
12598
12599    <div class="flex gap-4">
12600      <app-url-shortener />
12601    </div>
12602  </div>
12603</section>
12604` }]
12605  }], null, null);
12606})();
12607(() => {
12608  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(YoutubeExtrasComponent, { className: "YoutubeExtrasComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/youtube/youtube-extras.component.ts", lineNumber: 15 });
12609})();
12610
12611// libs/socialgest/messenger/src/presenter/components/extras/extras.component.ts
12612function ExtrasComponent_Conditional_0_Template(rf, ctx) {
12613  if (rf & 1) {
12614    \u0275\u0275elementStart(0, "section", 0);
12615    \u0275\u0275element(1, "app-instagram");
12616    \u0275\u0275elementEnd();
12617  }
12618}
12619function ExtrasComponent_Conditional_1_Template(rf, ctx) {
12620  if (rf & 1) {
12621    \u0275\u0275elementStart(0, "section", 0);
12622    \u0275\u0275element(1, "app-facebook");
12623    \u0275\u0275elementEnd();
12624  }
12625}
12626function ExtrasComponent_Conditional_2_Template(rf, ctx) {
12627  if (rf & 1) {
12628    \u0275\u0275elementStart(0, "section", 0);
12629    \u0275\u0275element(1, "app-linkedin");
12630    \u0275\u0275elementEnd();
12631  }
12632}
12633function ExtrasComponent_Conditional_3_Template(rf, ctx) {
12634  if (rf & 1) {
12635    \u0275\u0275elementStart(0, "section", 0);
12636    \u0275\u0275element(1, "app-telegram");
12637    \u0275\u0275elementEnd();
12638  }
12639}
12640function ExtrasComponent_Conditional_4_Template(rf, ctx) {
12641  if (rf & 1) {
12642    \u0275\u0275elementStart(0, "section", 0);
12643    \u0275\u0275element(1, "app-tiktok");
12644    \u0275\u0275elementEnd();
12645  }
12646}
12647function ExtrasComponent_Conditional_5_Template(rf, ctx) {
12648  if (rf & 1) {
12649    \u0275\u0275elementStart(0, "section", 0);
12650    \u0275\u0275element(1, "app-youtube-extras");
12651    \u0275\u0275elementEnd();
12652  }
12653}
12654function ExtrasComponent_Conditional_6_Template(rf, ctx) {
12655  if (rf & 1) {
12656    \u0275\u0275elementStart(0, "section", 0);
12657    \u0275\u0275element(1, "app-google-business");
12658    \u0275\u0275elementEnd();
12659  }
12660}
12661function ExtrasComponent_Conditional_7_Template(rf, ctx) {
12662  if (rf & 1) {
12663    \u0275\u0275elementStart(0, "section", 0);
12664    \u0275\u0275element(1, "app-pinterest");
12665    \u0275\u0275elementEnd();
12666  }
12667}
12668function ExtrasComponent_Conditional_8_Template(rf, ctx) {
12669  if (rf & 1) {
12670    \u0275\u0275elementStart(0, "section", 0);
12671    \u0275\u0275element(1, "app-x-extras");
12672    \u0275\u0275elementEnd();
12673  }
12674}
12675function ExtrasComponent_Conditional_9_Template(rf, ctx) {
12676  if (rf & 1) {
12677    \u0275\u0275elementStart(0, "section", 0);
12678    \u0275\u0275element(1, "app-threads-extras");
12679    \u0275\u0275elementEnd();
12680  }
12681}
12682var ExtrasComponent = class _ExtrasComponent {
12683  store = inject(MessengerStore);
12684  user = computed(() => User.partial({ type: this.store.userType() }));
12685  static \u0275fac = function ExtrasComponent_Factory(__ngFactoryType__) {
12686    return new (__ngFactoryType__ || _ExtrasComponent)();
12687  };
12688  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _ExtrasComponent, selectors: [["app-extras"]], decls: 10, vars: 1, consts: [[1, "pt-5", "pb-8", "border-t", "border-grey-50"]], template: function ExtrasComponent_Template(rf, ctx) {
12689    if (rf & 1) {
12690      \u0275\u0275conditionalCreate(0, ExtrasComponent_Conditional_0_Template, 2, 0, "section", 0)(1, ExtrasComponent_Conditional_1_Template, 2, 0, "section", 0)(2, ExtrasComponent_Conditional_2_Template, 2, 0, "section", 0)(3, ExtrasComponent_Conditional_3_Template, 2, 0, "section", 0)(4, ExtrasComponent_Conditional_4_Template, 2, 0, "section", 0)(5, ExtrasComponent_Conditional_5_Template, 2, 0, "section", 0)(6, ExtrasComponent_Conditional_6_Template, 2, 0, "section", 0)(7, ExtrasComponent_Conditional_7_Template, 2, 0, "section", 0)(8, ExtrasComponent_Conditional_8_Template, 2, 0, "section", 0)(9, ExtrasComponent_Conditional_9_Template, 2, 0, "section", 0);
12691    }
12692    if (rf & 2) {
12693      \u0275\u0275conditional(ctx.user().isInstagram ? 0 : ctx.user().isFacebook ? 1 : ctx.user().isLinkedin ? 2 : ctx.user().isTelegram ? 3 : ctx.user().isTiktok ? 4 : ctx.user().isYoutube ? 5 : ctx.user().isGoogleBusiness ? 6 : ctx.user().isPinterest ? 7 : ctx.user().isX ? 8 : ctx.user().isThreads ? 9 : -1);
12694    }
12695  }, dependencies: [
12696    CommonModule,
12697    FacebookComponent,
12698    GoogleBusinessComponent,
12699    InstagramComponent,
12700    LinkedinExtrasComponent,
12701    PinterestComponent,
12702    TelegramComponent,
12703    ThreadsExtrasComponent,
12704    TiktokComponent,
12705    XExtrasComponent,
12706    YoutubeExtrasComponent
12707  ], encapsulation: 2 });
12708};
12709(() => {
12710  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ExtrasComponent, [{
12711    type: Component,
12712    args: [{ selector: "app-extras", imports: [
12713      CommonModule,
12714      FacebookComponent,
12715      GoogleBusinessComponent,
12716      InstagramComponent,
12717      LinkedinExtrasComponent,
12718      PinterestComponent,
12719      TelegramComponent,
12720      ThreadsExtrasComponent,
12721      TiktokComponent,
12722      XExtrasComponent,
12723      YoutubeExtrasComponent
12724    ], template: '@if(user().isInstagram){\n<section class="pt-5 pb-8 border-t border-grey-50">\n  <app-instagram />\n</section>\n\n}@else if(user().isFacebook){\n<section class="pt-5 pb-8 border-t border-grey-50">\n  <app-facebook />\n</section>\n} @else if(user().isLinkedin){\n<section class="pt-5 pb-8 border-t border-grey-50">\n  <app-linkedin />\n</section>\n} @else if(user().isTelegram){\n<section class="pt-5 pb-8 border-t border-grey-50">\n  <app-telegram />\n</section>\n} @else if(user().isTiktok){\n<section class="pt-5 pb-8 border-t border-grey-50">\n  <app-tiktok />\n</section>\n} @else if(user().isYoutube){\n<section class="pt-5 pb-8 border-t border-grey-50">\n  <app-youtube-extras />\n</section>\n} @else if(user().isGoogleBusiness){\n<section class="pt-5 pb-8 border-t border-grey-50">\n  <app-google-business />\n</section>\n} @else if(user().isPinterest){\n<section class="pt-5 pb-8 border-t border-grey-50">\n  <app-pinterest />\n</section>\n} @else if(user().isX){\n<section class="pt-5 pb-8 border-t border-grey-50">\n  <app-x-extras />\n</section>\n} @else if(user().isThreads){\n<section class="pt-5 pb-8 border-t border-grey-50">\n  <app-threads-extras />\n</section>\n}\n' }]
12725  }], null, null);
12726})();
12727(() => {
12728  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(ExtrasComponent, { className: "ExtrasComponent", filePath: "libs/socialgest/messenger/src/presenter/components/extras/extras.component.ts", lineNumber: 33 });
12729})();
12730
12731// libs/socialgest/messenger/src/presenter/components/alerts/alerts.component.ts
12732function AlertsComponent_Conditional_0_Template(rf, ctx) {
12733  if (rf & 1) {
12734    \u0275\u0275elementStart(0, "article", 0);
12735    \u0275\u0275element(1, "ui-icon", 1);
12736    \u0275\u0275elementStart(2, "p");
12737    \u0275\u0275text(3);
12738    \u0275\u0275pipe(4, "translate");
12739    \u0275\u0275elementEnd()();
12740  }
12741  if (rf & 2) {
12742    \u0275\u0275advance(3);
12743    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 1, "MESSENGER.ALERTS.INSTAGRAM_NOTIFICATION"));
12744  }
12745}
12746var AlertsComponent = class _AlertsComponent {
12747  store = inject(MessengerStore);
12748  static \u0275fac = function AlertsComponent_Factory(__ngFactoryType__) {
12749    return new (__ngFactoryType__ || _AlertsComponent)();
12750  };
12751  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _AlertsComponent, selectors: [["app-alerts"]], decls: 1, vars: 1, consts: [[1, "flex", "items-center", "gap-3", "text-sm", "bg-[#FFF0E1]", "text-[#E9821B]", "rounded-sm", "p-1", "px-3", "mb-1.5", "animate-fadein"], ["name", "triangle-alert", "styleClass", "size-4"]], template: function AlertsComponent_Template(rf, ctx) {
12752    if (rf & 1) {
12753      \u0275\u0275conditionalCreate(0, AlertsComponent_Conditional_0_Template, 5, 3, "article", 0);
12754    }
12755    if (rf & 2) {
12756      const isPushable_r1 = ctx.store.isUserType().instagram || ctx.store.isUserType().tiktok;
12757      \u0275\u0275conditional(isPushable_r1 && ctx.store.post().is.instagram.story && (ctx.store.post().message.has.urls || ctx.store.post().options.instagram.location.isPresent) ? 0 : -1);
12758    }
12759  }, dependencies: [CommonModule, TranslatePipe, IconComponent], encapsulation: 2 });
12760};
12761(() => {
12762  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(AlertsComponent, [{
12763    type: Component,
12764    args: [{ selector: "app-alerts", imports: [CommonModule, TranslatePipe, IconComponent], template: `@let isPushable = store.isUserType().instagram || store.isUserType().tiktok; @if(isPushable &&
12765store.post().is.instagram.story && (store.post().message.has.urls ||
12766store.post().options.instagram.location.isPresent)){
12767<article class="flex items-center gap-3 text-sm bg-[#FFF0E1] text-[#E9821B] rounded-sm p-1 px-3 mb-1.5 animate-fadein">
12768  <ui-icon name="triangle-alert" styleClass="size-4" />
12769  <p>{{ 'MESSENGER.ALERTS.INSTAGRAM_NOTIFICATION' | translate }}</p>
12770</article>
12771
12772}
12773` }]
12774  }], null, null);
12775})();
12776(() => {
12777  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(AlertsComponent, { className: "AlertsComponent", filePath: "libs/socialgest/messenger/src/presenter/components/alerts/alerts.component.ts", lineNumber: 12 });
12778})();
12779
12780// libs/socialgest/messenger/src/presenter/components/personalize-toggle/personalize-toggle.component.ts
12781var PersonalizeToggleComponent = class _PersonalizeToggleComponent {
12782  store = inject(MessengerStore);
12783  personalized = inject(MessengerPersonalizedService);
12784  confirmDialog = inject(ConfirmDialogService);
12785  constructor() {
12786    effect(() => {
12787      const hasMentions = this.store.isMention().active;
12788      const hasThreads = this.store.isThread().active;
12789      const hasYoutube = this.store.post().userList.hasYoutube;
12790      const hasUsers = !this.store.post().userList.isEmpty;
12791      const isActive = this.store.personalized().active;
12792      if (!hasUsers && isActive) {
12793        this.personalized.disable();
12794        return;
12795      }
12796      if (hasUsers && (hasMentions || hasThreads || hasYoutube) && !isActive) {
12797        this.personalized.enable();
12798      }
12799    });
12800  }
12801  toggle() {
12802    if (this.store.personalized().active) {
12803      this.confirmDialog.warning({
12804        headerLabel: "MESSENGER.PERSONALIZE_DISABLE_TITLE",
12805        contentLabel: "MESSENGER.PERSONALIZE_DISABLE_DESCRIPTION",
12806        acceptLabel: "MESSENGER.PERSONALIZE_DISABLE_CONFIRM",
12807        rejectLabel: "GLOBAL.CANCEL"
12808      }).subscribe((result) => {
12809        result.mapRight(() => this.personalized.disable());
12810      });
12811    } else {
12812      this.personalized.enable();
12813    }
12814  }
12815  static \u0275fac = function PersonalizeToggleComponent_Factory(__ngFactoryType__) {
12816    return new (__ngFactoryType__ || _PersonalizeToggleComponent)();
12817  };
12818  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _PersonalizeToggleComponent, selectors: [["app-personalize-toggle"]], decls: 4, vars: 7, consts: [["tooltipPosition", "top", 1, "h-[2.7rem]", "px-3", "rounded-lg", "border", "cursor-pointer", "font-semibold", "transition-colors", 3, "click", "ngClass", "tooltip"]], template: function PersonalizeToggleComponent_Template(rf, ctx) {
12819    if (rf & 1) {
12820      \u0275\u0275elementStart(0, "button", 0);
12821      \u0275\u0275pipe(1, "translate");
12822      \u0275\u0275listener("click", function PersonalizeToggleComponent_Template_button_click_0_listener() {
12823        return ctx.toggle();
12824      });
12825      \u0275\u0275text(2);
12826      \u0275\u0275pipe(3, "translate");
12827      \u0275\u0275elementEnd();
12828    }
12829    if (rf & 2) {
12830      \u0275\u0275property("ngClass", ctx.store.personalized().active ? "bg-secondary-50 border-secondary-500 text-secondary-500" : "bg-white border-grey-100 text-grey-300")("tooltip", \u0275\u0275pipeBind1(1, 3, "MESSENGER.PERSONALIZE_TOOLTIP"));
12831      \u0275\u0275advance(2);
12832      \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(3, 5, "MESSENGER.PERSONALIZE"), "\n");
12833    }
12834  }, dependencies: [CommonModule, NgClass, TooltipDirective, TranslatePipe], encapsulation: 2 });
12835};
12836(() => {
12837  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(PersonalizeToggleComponent, [{
12838    type: Component,
12839    args: [{ selector: "app-personalize-toggle", imports: [CommonModule, TooltipDirective, TranslatePipe], template: `<button
12840  (click)="toggle()"
12841  class="h-[2.7rem] px-3 rounded-lg border cursor-pointer font-semibold transition-colors"
12842  [ngClass]="
12843    store.personalized().active
12844      ? 'bg-secondary-50 border-secondary-500 text-secondary-500'
12845      : 'bg-white border-grey-100 text-grey-300'
12846  "
12847  [tooltip]="'MESSENGER.PERSONALIZE_TOOLTIP' | translate"
12848  tooltipPosition="top"
12849>
12850  {{ 'MESSENGER.PERSONALIZE' | translate }}
12851</button>
12852` }]
12853  }], () => [], null);
12854})();
12855(() => {
12856  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(PersonalizeToggleComponent, { className: "PersonalizeToggleComponent", filePath: "libs/socialgest/messenger/src/presenter/components/personalize-toggle/personalize-toggle.component.ts", lineNumber: 12 });
12857})();
12858
12859// libs/socialgest/messenger/src/presenter/components/shortener-panel/shortener-panel.component.ts
12860function ShortenerPanelComponent_Conditional_11_Template(rf, ctx) {
12861  if (rf & 1) {
12862    const _r1 = \u0275\u0275getCurrentView();
12863    \u0275\u0275elementStart(0, "p", 7);
12864    \u0275\u0275element(1, "ui-icon", 20);
12865    \u0275\u0275elementStart(2, "span");
12866    \u0275\u0275text(3);
12867    \u0275\u0275pipe(4, "translate");
12868    \u0275\u0275elementStart(5, "button", 21);
12869    \u0275\u0275listener("click", function ShortenerPanelComponent_Conditional_11_Template_button_click_5_listener() {
12870      \u0275\u0275restoreView(_r1);
12871      const ctx_r1 = \u0275\u0275nextContext();
12872      return \u0275\u0275resetView(ctx_r1.connectBitly());
12873    });
12874    \u0275\u0275text(6);
12875    \u0275\u0275pipe(7, "translate");
12876    \u0275\u0275elementEnd()()();
12877  }
12878  if (rf & 2) {
12879    const ctx_r1 = \u0275\u0275nextContext();
12880    \u0275\u0275advance(3);
12881    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(4, 3, "MESSENGER.SHORTENER.BITLY_NO_ACCOUNT"), " ");
12882    \u0275\u0275advance(2);
12883    \u0275\u0275property("disabled", ctx_r1.connectingBitly());
12884    \u0275\u0275advance();
12885    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(7, 5, ctx_r1.connectingBitly() ? "GLOBAL.PROGRESS.LOADING" : "MESSENGER.SHORTENER.CONNECT_BITLY"), " ");
12886  }
12887}
12888function ShortenerPanelComponent_Conditional_18_Template(rf, ctx) {
12889  if (rf & 1) {
12890    const _r3 = \u0275\u0275getCurrentView();
12891    \u0275\u0275elementStart(0, "ui-button", 22);
12892    \u0275\u0275pipe(1, "translate");
12893    \u0275\u0275listener("click", function ShortenerPanelComponent_Conditional_18_Template_ui_button_click_0_listener() {
12894      \u0275\u0275restoreView(_r3);
12895      const ctx_r1 = \u0275\u0275nextContext();
12896      return \u0275\u0275resetView(ctx_r1.copy());
12897    });
12898    \u0275\u0275elementEnd();
12899    \u0275\u0275elementStart(2, "ui-button", 23);
12900    \u0275\u0275pipe(3, "translate");
12901    \u0275\u0275listener("click", function ShortenerPanelComponent_Conditional_18_Template_ui_button_click_2_listener() {
12902      \u0275\u0275restoreView(_r3);
12903      const ctx_r1 = \u0275\u0275nextContext();
12904      return \u0275\u0275resetView(ctx_r1.clear());
12905    });
12906    \u0275\u0275elementEnd();
12907  }
12908  if (rf & 2) {
12909    \u0275\u0275property("fluid", false)("tooltip", \u0275\u0275pipeBind1(1, 6, "MESSENGER.SHORTENER.COPY"))("tooltipPosition", "top");
12910    \u0275\u0275advance(2);
12911    \u0275\u0275property("fluid", false)("tooltip", \u0275\u0275pipeBind1(3, 8, "MESSENGER.SHORTENER.CLEAR"))("tooltipPosition", "top");
12912  }
12913}
12914function ShortenerPanelComponent_Conditional_19_Template(rf, ctx) {
12915  if (rf & 1) {
12916    const _r4 = \u0275\u0275getCurrentView();
12917    \u0275\u0275elementStart(0, "ui-button", 24);
12918    \u0275\u0275listener("click", function ShortenerPanelComponent_Conditional_19_Template_ui_button_click_0_listener() {
12919      \u0275\u0275restoreView(_r4);
12920      const ctx_r1 = \u0275\u0275nextContext();
12921      return \u0275\u0275resetView(ctx_r1.shorten());
12922    });
12923    \u0275\u0275elementEnd();
12924  }
12925  if (rf & 2) {
12926    const ctx_r1 = \u0275\u0275nextContext();
12927    \u0275\u0275property("isLoading", ctx_r1.loading())("fluid", false);
12928  }
12929}
12930function ShortenerPanelComponent_Conditional_30_Template(rf, ctx) {
12931  if (rf & 1) {
12932    \u0275\u0275elementStart(0, "span", 12);
12933    \u0275\u0275text(1);
12934    \u0275\u0275pipe(2, "translate");
12935    \u0275\u0275elementEnd();
12936  }
12937  if (rf & 2) {
12938    \u0275\u0275advance();
12939    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(2, 1, "MESSENGER.SHORTENER.ERRORS.CUSTOM_LINK_INVALID"), " ");
12940  }
12941}
12942function ShortenerPanelComponent_Conditional_46_Template(rf, ctx) {
12943  if (rf & 1) {
12944    \u0275\u0275elementStart(0, "div", 19)(1, "div", 4)(2, "span", 5);
12945    \u0275\u0275text(3);
12946    \u0275\u0275pipe(4, "translate");
12947    \u0275\u0275elementEnd();
12948    \u0275\u0275element(5, "ui-input-text", 11);
12949    \u0275\u0275elementEnd();
12950    \u0275\u0275elementStart(6, "div", 4)(7, "span", 5);
12951    \u0275\u0275text(8);
12952    \u0275\u0275pipe(9, "translate");
12953    \u0275\u0275elementEnd();
12954    \u0275\u0275element(10, "ui-input-text", 11);
12955    \u0275\u0275elementEnd();
12956    \u0275\u0275elementStart(11, "div", 4)(12, "span", 5);
12957    \u0275\u0275text(13);
12958    \u0275\u0275pipe(14, "translate");
12959    \u0275\u0275elementEnd();
12960    \u0275\u0275element(15, "ui-input-text", 11);
12961    \u0275\u0275elementEnd();
12962    \u0275\u0275elementStart(16, "div", 4)(17, "span", 5);
12963    \u0275\u0275text(18);
12964    \u0275\u0275pipe(19, "translate");
12965    \u0275\u0275elementEnd();
12966    \u0275\u0275element(20, "ui-input-text", 11);
12967    \u0275\u0275elementEnd()();
12968  }
12969  if (rf & 2) {
12970    const ctx_r1 = \u0275\u0275nextContext();
12971    \u0275\u0275advance(3);
12972    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 12, "MESSENGER.SHORTENER.SOURCE"));
12973    \u0275\u0275advance(2);
12974    \u0275\u0275property("formControl", ctx_r1.form.controls.source)("placeholder", "MESSENGER.SHORTENER.SOURCE_EXAMPLE");
12975    \u0275\u0275advance(3);
12976    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(9, 14, "MESSENGER.SHORTENER.MEDIUM"));
12977    \u0275\u0275advance(2);
12978    \u0275\u0275property("formControl", ctx_r1.form.controls.medium)("placeholder", "MESSENGER.SHORTENER.MEDIUM_EXAMPLE");
12979    \u0275\u0275advance(3);
12980    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(14, 16, "MESSENGER.SHORTENER.CAMPAIGN"));
12981    \u0275\u0275advance(2);
12982    \u0275\u0275property("formControl", ctx_r1.form.controls.campaign)("placeholder", "MESSENGER.SHORTENER.CAMPAIGN_EXAMPLE");
12983    \u0275\u0275advance(3);
12984    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(19, 18, "MESSENGER.SHORTENER.TERM"));
12985    \u0275\u0275advance(2);
12986    \u0275\u0275property("formControl", ctx_r1.form.controls.term)("placeholder", "MESSENGER.SHORTENER.TERM_EXAMPLE");
12987  }
12988}
12989var CUSTOM_LINK_PATTERN = /^[a-zA-Z0-9_-]*$/;
12990var UTM_HELP_URL = "https://support.google.com/analytics/answer/10917952";
12991var ShortenerPanelComponent = class _ShortenerPanelComponent {
12992  store = inject(MessengerStore);
12993  facade = inject(MessengerFacade);
12994  handler = inject(UrlShortenerHandler);
12995  toast = inject(SonnerToasterService);
12996  destroyRef = inject(DestroyRef);
12997  userStore = inject(UserStore);
12998  connectFacade = inject(ConnectFacade);
12999  connectingBitly = signal(false);
13000  showBitlyHint = computed(() => this.store.shortener().provider === ShortenerType.BITLY && !this.userStore.userList().hasBitly);
13001  loading = signal(false);
13002  shortened = signal(false);
13003  showUtm = signal(false);
13004  utmHelpUrl = UTM_HELP_URL;
13005  providerOptions = [
13006    { label: "sge.st", value: ShortenerType.SOCIALGEST },
13007    { label: "Bitly", value: ShortenerType.BITLY }
13008  ];
13009  form = new FormGroup({
13010    url: new FormControl("", { nonNullable: true, validators: [Validators.required, Validators.pattern(URL_REGEX)] }),
13011    title: new FormControl("", { nonNullable: true }),
13012    custom_link: new FormControl("", { nonNullable: true, validators: [Validators.pattern(CUSTOM_LINK_PATTERN)] }),
13013    source: new FormControl("", { nonNullable: true }),
13014    medium: new FormControl("", { nonNullable: true }),
13015    campaign: new FormControl("", { nonNullable: true }),
13016    term: new FormControl("", { nonNullable: true })
13017  });
13018  constructor() {
13019    this.form.controls.url.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => this.shortened.set(false));
13020    effect(() => {
13021      const isOpen = this.store.dialog().isShortener;
13022      if (!isOpen)
13023        untracked(() => this.clear());
13024    });
13025  }
13026  close() {
13027    this.store.toggleShortener();
13028  }
13029  onProviderChange(provider) {
13030    this.store.setShortenerProvider(provider);
13031  }
13032  connectBitly() {
13033    return __async(this, null, function* () {
13034      if (this.connectingBitly())
13035        return;
13036      this.connectingBitly.set(true);
13037      const result = yield this.connectFacade.loginWithBitly();
13038      this.connectingBitly.set(false);
13039      result.mapRight(() => {
13040        this.userStore.update();
13041        this.toast.success("MESSENGER.SHORTENER.BITLY_CONNECTED");
13042      });
13043    });
13044  }
13045  setAutoShorten(active) {
13046    if (this.store.shortener().autoShorten !== active) {
13047      this.store.toggleAutoShorten();
13048    }
13049  }
13050  shorten() {
13051    return __async(this, null, function* () {
13052      if (this.form.controls.url.invalid) {
13053        this.form.controls.url.markAsTouched();
13054        return;
13055      }
13056      this.loading.set(true);
13057      const result = yield this.facade.shortenUrl(this.buildOptions(), this.store.shortener().provider);
13058      this.loading.set(false);
13059      result.mapRight((shortResult) => {
13060        this.clearOptionalFields();
13061        this.form.controls.url.setValue(shortResult.shortUrl, { emitEvent: false });
13062        this.handler.insert(shortResult.shortUrl);
13063        this.toast.success("MESSENGER.SHORTENER.LINK_SHORTENED_SUCCESSFULLY");
13064        this.shortened.set(true);
13065      });
13066      result.mapLeft(() => this.shortened.set(false));
13067    });
13068  }
13069  copy() {
13070    navigator.clipboard.writeText(this.form.controls.url.value);
13071    this.toast.success("MESSENGER.SHORTENER.COPIED_LINK");
13072  }
13073  clear() {
13074    this.form.reset();
13075    this.showUtm.set(false);
13076    this.shortened.set(false);
13077  }
13078  clearOptionalFields() {
13079    this.form.controls.title.setValue("");
13080    this.form.controls.custom_link.setValue("");
13081    this.form.controls.source.setValue("");
13082    this.form.controls.medium.setValue("");
13083    this.form.controls.campaign.setValue("");
13084    this.form.controls.term.setValue("");
13085  }
13086  buildOptions() {
13087    const raw = this.form.getRawValue();
13088    const options = { url: raw.url.trim() };
13089    if (raw.title.trim())
13090      options.title = raw.title.trim();
13091    if (raw.custom_link.trim())
13092      options.custom_link = raw.custom_link.trim();
13093    if (this.showUtm()) {
13094      if (raw.source.trim())
13095        options.source = raw.source.trim();
13096      if (raw.medium.trim())
13097        options.medium = raw.medium.trim();
13098      if (raw.campaign.trim())
13099        options.campaign = raw.campaign.trim();
13100      if (raw.term.trim())
13101        options.term = raw.term.trim();
13102    }
13103    return options;
13104  }
13105  static \u0275fac = function ShortenerPanelComponent_Factory(__ngFactoryType__) {
13106    return new (__ngFactoryType__ || _ShortenerPanelComponent)();
13107  };
13108  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _ShortenerPanelComponent, selectors: [["app-shortener-panel"]], decls: 47, vars: 40, consts: [[1, "absolute", "inset-0", "flex", "flex-col", "gap-6", "p-6", "overflow-y-auto"], [1, "flex", "items-center", "justify-between"], [1, "text-lg", "font-semibold"], ["name", "x", "styleClass", "size-5 cursor-pointer text-grey-300", 3, "click"], [1, "flex", "flex-col", "gap-2"], [1, "text-sm", "font-semibold", "font-display"], ["optionLabel", "label", "optionValue", "value", 3, "valueChange", "options", "translateLabels", "value"], [1, "flex", "items-start", "gap-2", "rounded-lg", "bg-amber-50", "p-2.5", "text-xs", "font-medium", "text-amber-700"], [1, "flex", "items-end", "gap-2"], [1, "flex-1", "min-w-0", 3, "formControl", "placeholder"], ["label", "MESSENGER.SHORTENER.SHORTEN", "severity", "contrast", 3, "isLoading", "fluid"], [3, "formControl", "placeholder"], ["role", "alert", 1, "text-xs", "text-red-500"], [1, "flex", "items-center", "gap-2.5"], [3, "enable", "disable", "ngModel"], [1, "text-sm", "text-grey-500", "font-medium", "font-display"], [1, "border-t", "border-grey-50"], [1, "text-base", "font-bold", "font-display", "text-grey-400"], ["target", "_blank", "rel", "noopener noreferrer", 1, "text-sm", "font-semibold", "font-display", "text-primary-400", 3, "href"], [1, "flex", "flex-col", "gap-4"], ["name", "triangleAlert", "styleClass", "size-4 shrink-0 text-amber-500"], ["type", "button", 1, "font-semibold", "underline", "cursor-pointer", "disabled:opacity-60", 3, "click", "disabled"], ["icon", "copy", "severity", "contrast", "styleClass", "aspect-square", 3, "click", "fluid", "tooltip", "tooltipPosition"], ["icon", "eraser", "severity", "contrast", "styleClass", "aspect-square", 3, "click", "fluid", "tooltip", "tooltipPosition"], ["label", "MESSENGER.SHORTENER.SHORTEN", "severity", "contrast", 3, "click", "isLoading", "fluid"]], template: function ShortenerPanelComponent_Template(rf, ctx) {
13109    if (rf & 1) {
13110      \u0275\u0275elementStart(0, "div", 0)(1, "div", 1)(2, "h2", 2);
13111      \u0275\u0275text(3);
13112      \u0275\u0275pipe(4, "translate");
13113      \u0275\u0275elementEnd();
13114      \u0275\u0275elementStart(5, "ui-icon", 3);
13115      \u0275\u0275listener("click", function ShortenerPanelComponent_Template_ui_icon_click_5_listener() {
13116        return ctx.close();
13117      });
13118      \u0275\u0275elementEnd()();
13119      \u0275\u0275elementStart(6, "div", 4)(7, "span", 5);
13120      \u0275\u0275text(8);
13121      \u0275\u0275pipe(9, "translate");
13122      \u0275\u0275elementEnd();
13123      \u0275\u0275elementStart(10, "ui-select", 6);
13124      \u0275\u0275listener("valueChange", function ShortenerPanelComponent_Template_ui_select_valueChange_10_listener($event) {
13125        return ctx.onProviderChange($event);
13126      });
13127      \u0275\u0275elementEnd();
13128      \u0275\u0275conditionalCreate(11, ShortenerPanelComponent_Conditional_11_Template, 8, 7, "p", 7);
13129      \u0275\u0275elementEnd();
13130      \u0275\u0275elementStart(12, "div", 4)(13, "span", 5);
13131      \u0275\u0275text(14);
13132      \u0275\u0275pipe(15, "translate");
13133      \u0275\u0275elementEnd();
13134      \u0275\u0275elementStart(16, "div", 8);
13135      \u0275\u0275element(17, "ui-input-text", 9);
13136      \u0275\u0275conditionalCreate(18, ShortenerPanelComponent_Conditional_18_Template, 4, 10)(19, ShortenerPanelComponent_Conditional_19_Template, 1, 2, "ui-button", 10);
13137      \u0275\u0275elementEnd()();
13138      \u0275\u0275elementStart(20, "div", 4)(21, "span", 5);
13139      \u0275\u0275text(22);
13140      \u0275\u0275pipe(23, "translate");
13141      \u0275\u0275elementEnd();
13142      \u0275\u0275element(24, "ui-input-text", 11);
13143      \u0275\u0275elementEnd();
13144      \u0275\u0275elementStart(25, "div", 4)(26, "span", 5);
13145      \u0275\u0275text(27);
13146      \u0275\u0275pipe(28, "translate");
13147      \u0275\u0275elementEnd();
13148      \u0275\u0275element(29, "ui-input-text", 11);
13149      \u0275\u0275conditionalCreate(30, ShortenerPanelComponent_Conditional_30_Template, 3, 3, "span", 12);
13150      \u0275\u0275elementEnd();
13151      \u0275\u0275elementStart(31, "div", 13)(32, "ui-toggle", 14);
13152      \u0275\u0275listener("enable", function ShortenerPanelComponent_Template_ui_toggle_enable_32_listener() {
13153        return ctx.setAutoShorten(true);
13154      })("disable", function ShortenerPanelComponent_Template_ui_toggle_disable_32_listener() {
13155        return ctx.setAutoShorten(false);
13156      });
13157      \u0275\u0275elementEnd();
13158      \u0275\u0275elementStart(33, "span", 15);
13159      \u0275\u0275text(34);
13160      \u0275\u0275pipe(35, "translate");
13161      \u0275\u0275elementEnd()();
13162      \u0275\u0275element(36, "hr", 16);
13163      \u0275\u0275elementStart(37, "div", 4)(38, "div", 13)(39, "ui-toggle", 14);
13164      \u0275\u0275listener("enable", function ShortenerPanelComponent_Template_ui_toggle_enable_39_listener() {
13165        return ctx.showUtm.set(true);
13166      })("disable", function ShortenerPanelComponent_Template_ui_toggle_disable_39_listener() {
13167        return ctx.showUtm.set(false);
13168      });
13169      \u0275\u0275elementEnd();
13170      \u0275\u0275elementStart(40, "span", 17);
13171      \u0275\u0275text(41);
13172      \u0275\u0275pipe(42, "translate");
13173      \u0275\u0275elementEnd()();
13174      \u0275\u0275elementStart(43, "a", 18);
13175      \u0275\u0275text(44);
13176      \u0275\u0275pipe(45, "translate");
13177      \u0275\u0275elementEnd()();
13178      \u0275\u0275conditionalCreate(46, ShortenerPanelComponent_Conditional_46_Template, 21, 20, "div", 19);
13179      \u0275\u0275elementEnd();
13180    }
13181    if (rf & 2) {
13182      \u0275\u0275advance(3);
13183      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 24, "MESSENGER.SHORTENER.TITLE"));
13184      \u0275\u0275advance(5);
13185      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(9, 26, "MESSENGER.SHORTENER.SELECT_SHORTENER"));
13186      \u0275\u0275advance(2);
13187      \u0275\u0275property("options", ctx.providerOptions)("translateLabels", false)("value", ctx.store.shortener().provider);
13188      \u0275\u0275advance();
13189      \u0275\u0275conditional(ctx.showBitlyHint() ? 11 : -1);
13190      \u0275\u0275advance(3);
13191      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(15, 28, "MESSENGER.SHORTENER.DESTINATION_URL"));
13192      \u0275\u0275advance(3);
13193      \u0275\u0275property("formControl", ctx.form.controls.url)("placeholder", "MESSENGER.SHORTENER.ENTER_LINK_TO_SHORTEN");
13194      \u0275\u0275advance();
13195      \u0275\u0275conditional(ctx.shortened() ? 18 : 19);
13196      \u0275\u0275advance(4);
13197      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(23, 30, "MESSENGER.SHORTENER.TITLE_OPTIONAL"));
13198      \u0275\u0275advance(2);
13199      \u0275\u0275property("formControl", ctx.form.controls.title)("placeholder", "MESSENGER.SHORTENER.ENTER_TITLE");
13200      \u0275\u0275advance(3);
13201      \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(28, 32, "MESSENGER.SHORTENER.CUSTOM_LINK_OPTIONAL"), " ");
13202      \u0275\u0275advance(2);
13203      \u0275\u0275property("formControl", ctx.form.controls.custom_link)("placeholder", "MESSENGER.SHORTENER.ENTER_CUSTOM_LINK");
13204      \u0275\u0275advance();
13205      \u0275\u0275conditional(ctx.form.controls.custom_link.invalid && ctx.form.controls.custom_link.touched ? 30 : -1);
13206      \u0275\u0275advance(2);
13207      \u0275\u0275property("ngModel", ctx.store.shortener().autoShorten);
13208      \u0275\u0275advance(2);
13209      \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(35, 34, "MESSENGER.SHORTENER.AUTOMATICALLY_SHORTEN"), " ");
13210      \u0275\u0275advance(5);
13211      \u0275\u0275property("ngModel", ctx.showUtm());
13212      \u0275\u0275advance(2);
13213      \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(42, 36, "MESSENGER.SHORTENER.UTM_PARAMETERS"), " ");
13214      \u0275\u0275advance(2);
13215      \u0275\u0275property("href", ctx.utmHelpUrl, \u0275\u0275sanitizeUrl);
13216      \u0275\u0275advance();
13217      \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(45, 38, "MESSENGER.SHORTENER.UTM_PARAMETERS_LINK"), " ");
13218      \u0275\u0275advance(2);
13219      \u0275\u0275conditional(ctx.showUtm() ? 46 : -1);
13220    }
13221  }, dependencies: [
13222    CommonModule,
13223    FormsModule,
13224    NgControlStatus,
13225    NgModel,
13226    ReactiveFormsModule,
13227    FormControlDirective,
13228    TranslatePipe,
13229    ButtonComponent,
13230    IconComponent,
13231    InputTextComponent,
13232    SelectComponent,
13233    ToggleComponent,
13234    TooltipDirective
13235  ], encapsulation: 2 });
13236};
13237(() => {
13238  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ShortenerPanelComponent, [{
13239    type: Component,
13240    args: [{ selector: "app-shortener-panel", imports: [
13241      CommonModule,
13242      FormsModule,
13243      ReactiveFormsModule,
13244      TranslatePipe,
13245      ButtonComponent,
13246      IconComponent,
13247      InputTextComponent,
13248      SelectComponent,
13249      ToggleComponent,
13250      TooltipDirective
13251    ], template: `<div class="absolute inset-0 flex flex-col gap-6 p-6 overflow-y-auto">
13252  <div class="flex items-center justify-between">
13253    <h2 class="text-lg font-semibold">{{ 'MESSENGER.SHORTENER.TITLE' | translate }}</h2>
13254    <ui-icon name="x" styleClass="size-5 cursor-pointer text-grey-300" (click)="close()" />
13255  </div>
13256
13257  <div class="flex flex-col gap-2">
13258    <span class="text-sm font-semibold font-display">{{ 'MESSENGER.SHORTENER.SELECT_SHORTENER' | translate }}</span>
13259    <ui-select
13260      [options]="providerOptions"
13261      optionLabel="label"
13262      optionValue="value"
13263      [translateLabels]="false"
13264      [value]="store.shortener().provider"
13265      (valueChange)="onProviderChange($event)"
13266    />
13267    @if (showBitlyHint()) {
13268    <p class="flex items-start gap-2 rounded-lg bg-amber-50 p-2.5 text-xs font-medium text-amber-700">
13269      <ui-icon name="triangleAlert" styleClass="size-4 shrink-0 text-amber-500" />
13270      <span>
13271        {{ 'MESSENGER.SHORTENER.BITLY_NO_ACCOUNT' | translate }}
13272        <button
13273          type="button"
13274          (click)="connectBitly()"
13275          [disabled]="connectingBitly()"
13276          class="font-semibold underline cursor-pointer disabled:opacity-60"
13277        >
13278          {{ (connectingBitly() ? 'GLOBAL.PROGRESS.LOADING' : 'MESSENGER.SHORTENER.CONNECT_BITLY') | translate }}
13279        </button>
13280      </span>
13281    </p>
13282    }
13283  </div>
13284
13285  <div class="flex flex-col gap-2">
13286    <span class="text-sm font-semibold font-display">{{ 'MESSENGER.SHORTENER.DESTINATION_URL' | translate }}</span>
13287    <div class="flex items-end gap-2">
13288      <ui-input-text
13289        class="flex-1 min-w-0"
13290        [formControl]="form.controls.url"
13291        [placeholder]="'MESSENGER.SHORTENER.ENTER_LINK_TO_SHORTEN'"
13292      />
13293      @if (shortened()) {
13294      <ui-button
13295        (click)="copy()"
13296        icon="copy"
13297        severity="contrast"
13298        [fluid]="false"
13299        [tooltip]="'MESSENGER.SHORTENER.COPY' | translate"
13300        [tooltipPosition]="'top'"
13301        styleClass="aspect-square"
13302      />
13303      <ui-button
13304        (click)="clear()"
13305        icon="eraser"
13306        severity="contrast"
13307        [fluid]="false"
13308        [tooltip]="'MESSENGER.SHORTENER.CLEAR' | translate"
13309        [tooltipPosition]="'top'"
13310        styleClass="aspect-square"
13311      />
13312      } @else {
13313      <ui-button
13314        (click)="shorten()"
13315        label="MESSENGER.SHORTENER.SHORTEN"
13316        [isLoading]="loading()"
13317        severity="contrast"
13318        [fluid]="false"
13319      />
13320      }
13321    </div>
13322  </div>
13323
13324  <div class="flex flex-col gap-2">
13325    <span class="text-sm font-semibold font-display">{{ 'MESSENGER.SHORTENER.TITLE_OPTIONAL' | translate }}</span>
13326    <ui-input-text [formControl]="form.controls.title" [placeholder]="'MESSENGER.SHORTENER.ENTER_TITLE'" />
13327  </div>
13328
13329  <div class="flex flex-col gap-2">
13330    <span class="text-sm font-semibold font-display">
13331      {{ 'MESSENGER.SHORTENER.CUSTOM_LINK_OPTIONAL' | translate }}
13332    </span>
13333    <ui-input-text [formControl]="form.controls.custom_link" [placeholder]="'MESSENGER.SHORTENER.ENTER_CUSTOM_LINK'" />
13334    @if (form.controls.custom_link.invalid && form.controls.custom_link.touched) {
13335    <span role="alert" class="text-xs text-red-500">
13336      {{ 'MESSENGER.SHORTENER.ERRORS.CUSTOM_LINK_INVALID' | translate }}
13337    </span>
13338    }
13339  </div>
13340
13341  <div class="flex items-center gap-2.5">
13342    <ui-toggle
13343      [ngModel]="store.shortener().autoShorten"
13344      (enable)="setAutoShorten(true)"
13345      (disable)="setAutoShorten(false)"
13346    />
13347    <span class="text-sm text-grey-500 font-medium font-display">
13348      {{ 'MESSENGER.SHORTENER.AUTOMATICALLY_SHORTEN' | translate }}
13349    </span>
13350  </div>
13351
13352  <hr class="border-t border-grey-50" />
13353
13354  <div class="flex flex-col gap-2">
13355    <div class="flex items-center gap-2.5">
13356      <ui-toggle [ngModel]="showUtm()" (enable)="showUtm.set(true)" (disable)="showUtm.set(false)" />
13357      <span class="text-base font-bold font-display text-grey-400">
13358        {{ 'MESSENGER.SHORTENER.UTM_PARAMETERS' | translate }}
13359      </span>
13360    </div>
13361    <a
13362      [href]="utmHelpUrl"
13363      target="_blank"
13364      rel="noopener noreferrer"
13365      class="text-sm font-semibold font-display text-primary-400"
13366    >
13367      {{ 'MESSENGER.SHORTENER.UTM_PARAMETERS_LINK' | translate }}
13368    </a>
13369  </div>
13370
13371  @if (showUtm()) {
13372  <div class="flex flex-col gap-4">
13373    <div class="flex flex-col gap-2">
13374      <span class="text-sm font-semibold font-display">{{ 'MESSENGER.SHORTENER.SOURCE' | translate }}</span>
13375      <ui-input-text [formControl]="form.controls.source" [placeholder]="'MESSENGER.SHORTENER.SOURCE_EXAMPLE'" />
13376    </div>
13377    <div class="flex flex-col gap-2">
13378      <span class="text-sm font-semibold font-display">{{ 'MESSENGER.SHORTENER.MEDIUM' | translate }}</span>
13379      <ui-input-text [formControl]="form.controls.medium" [placeholder]="'MESSENGER.SHORTENER.MEDIUM_EXAMPLE'" />
13380    </div>
13381    <div class="flex flex-col gap-2">
13382      <span class="text-sm font-semibold font-display">{{ 'MESSENGER.SHORTENER.CAMPAIGN' | translate }}</span>
13383      <ui-input-text [formControl]="form.controls.campaign" [placeholder]="'MESSENGER.SHORTENER.CAMPAIGN_EXAMPLE'" />
13384    </div>
13385    <div class="flex flex-col gap-2">
13386      <span class="text-sm font-semibold font-display">{{ 'MESSENGER.SHORTENER.TERM' | translate }}</span>
13387      <ui-input-text [formControl]="form.controls.term" [placeholder]="'MESSENGER.SHORTENER.TERM_EXAMPLE'" />
13388    </div>
13389  </div>
13390  }
13391</div>
13392` }]
13393  }], () => [], null);
13394})();
13395(() => {
13396  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(ShortenerPanelComponent, { className: "ShortenerPanelComponent", filePath: "libs/socialgest/messenger/src/presenter/components/shortener-panel/shortener-panel.component.ts", lineNumber: 41 });
13397})();
13398
13399// libs/socialgest/messenger/src/presenter/views/default/default.component.ts
13400var DefaultComponent = class _DefaultComponent {
13401  store = inject(MessengerStore);
13402  static \u0275fac = function DefaultComponent_Factory(__ngFactoryType__) {
13403    return new (__ngFactoryType__ || _DefaultComponent)();
13404  };
13405  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _DefaultComponent, selectors: [["app-default"]], decls: 7, vars: 5, consts: [[1, "h-full", "grid", "grid-rows-[1fr_auto]"], [3, "placeholder"], [1, "py-5", "relative", "h-50"], [1, "absolute", "h-full", "w-full", "top-5", "left-0"], [3, "valueChange", "editWithCanva", "source", "size"]], template: function DefaultComponent_Template(rf, ctx) {
13406    if (rf & 1) {
13407      \u0275\u0275elementStart(0, "article", 0)(1, "section");
13408      \u0275\u0275element(2, "app-textarea", 1);
13409      \u0275\u0275pipe(3, "translate");
13410      \u0275\u0275elementEnd();
13411      \u0275\u0275elementStart(4, "section", 2)(5, "section", 3)(6, "ui-multimedia-list", 4);
13412      \u0275\u0275listener("valueChange", function DefaultComponent_Template_ui_multimedia_list_valueChange_6_listener() {
13413        return ctx.store.refresh();
13414      })("editWithCanva", function DefaultComponent_Template_ui_multimedia_list_editWithCanva_6_listener($event) {
13415        return ctx.store.editWithCanva($event);
13416      });
13417      \u0275\u0275elementEnd()()()();
13418    }
13419    if (rf & 2) {
13420      \u0275\u0275advance(2);
13421      \u0275\u0275property("placeholder", \u0275\u0275pipeBind1(3, 3, "MESSENGER.TEXTAREA_PLACEHOLDER"));
13422      \u0275\u0275advance(4);
13423      \u0275\u0275property("source", ctx.store)("size", "size-36");
13424    }
13425  }, dependencies: [CommonModule, TranslatePipe, MultimediaListComponent, TextareaComponent2], encapsulation: 2 });
13426};
13427(() => {
13428  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(DefaultComponent, [{
13429    type: Component,
13430    args: [{ selector: "app-default", imports: [CommonModule, TranslatePipe, MultimediaListComponent, TextareaComponent2], template: `<article class="h-full grid grid-rows-[1fr_auto]">
13431  <section>
13432    <app-textarea [placeholder]="'MESSENGER.TEXTAREA_PLACEHOLDER' | translate" />
13433  </section>
13434
13435  <section class="py-5 relative h-50">
13436    <section class="absolute h-full w-full top-5 left-0">
13437      <ui-multimedia-list
13438        (valueChange)="store.refresh()"
13439        (editWithCanva)="store.editWithCanva($event)"
13440        [source]="store"
13441        [size]="'size-36'"
13442      />
13443    </section>
13444  </section>
13445</article>
13446` }]
13447  }], null, null);
13448})();
13449(() => {
13450  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(DefaultComponent, { className: "DefaultComponent", filePath: "libs/socialgest/messenger/src/presenter/views/default/default.component.ts", lineNumber: 13 });
13451})();
13452
13453// libs/socialgest/messenger/src/presenter/views/thread/thread-post-box/thread-post-box.component.ts
13454var _c014 = (a0) => ({ "border-red-500!": a0 });
13455function ThreadPostBoxComponent_Conditional_4_Template(rf, ctx) {
13456  if (rf & 1) {
13457    \u0275\u0275element(0, "div", 3);
13458  }
13459}
13460function ThreadPostBoxComponent_Conditional_9_Template(rf, ctx) {
13461  if (rf & 1) {
13462    \u0275\u0275elementStart(0, "span", 8);
13463    \u0275\u0275pipe(1, "translate");
13464    \u0275\u0275text(2);
13465    \u0275\u0275elementEnd();
13466  }
13467  if (rf & 2) {
13468    const ctx_r0 = \u0275\u0275nextContext();
13469    \u0275\u0275property("ngClass", ctx_r0.cashtagCount() > ctx_r0.cashtagMax ? "text-red-500 font-semibold" : "text-grey-300")("tooltip", \u0275\u0275pipeBind1(1, 4, "MESSENGER.COUNTERS.CASHTAGS_TOOLTIP"));
13470    \u0275\u0275advance(2);
13471    \u0275\u0275textInterpolate2(" $ ", ctx_r0.cashtagCount(), "/", ctx_r0.cashtagMax, " ");
13472  }
13473}
13474var ThreadPostBoxComponent = class _ThreadPostBoxComponent {
13475  store = inject(MessengerStore);
13476  isMainPost = input(false);
13477  threadPost = input();
13478  index = input.required();
13479  isLast = input(false);
13480  charLimit = input.required();
13481  messageLength = signal(0);
13482  isOverLimit = computed(() => this.messageLength() > this.charLimit());
13483  // The 1-cashtag cap is per tweet, so each thread box carries its own counter.
13484  isX = computed(() => this.store.userType() === UserType.X);
13485  cashtagMax = Post.X_CASHTAG_MAX;
13486  cashtagCount = computed(() => $string.cashtags(this.message()).count);
13487  version = signal(0);
13488  message = computed(() => {
13489    if (this.isMainPost())
13490      return this.store.post().message.value;
13491    return this.threadPost()?.message ?? "";
13492  });
13493  postSource = computed(() => {
13494    this.version();
13495    if (this.isMainPost())
13496      return this.store;
13497    const threadPost = this.threadPost();
13498    const mainPost = this.store.post();
13499    const virtualPost = mainPost.copy();
13500    virtualPost.multimediaList = threadPost.multimediaList;
13501    return { post: signal(virtualPost), canvaConnected: this.store.canvaConnected };
13502  });
13503  onMessageChange(value) {
13504    this.messageLength.set(value.length);
13505    if (this.isMainPost()) {
13506      this.store.post().set.message(value);
13507    } else {
13508      this.threadPost().message = value;
13509    }
13510    this.store.refresh();
13511  }
13512  onMultimediaChange() {
13513    this.version.update((v) => v + 1);
13514    this.store.refresh();
13515  }
13516  static \u0275fac = function ThreadPostBoxComponent_Factory(__ngFactoryType__) {
13517    return new (__ngFactoryType__ || _ThreadPostBoxComponent)();
13518  };
13519  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _ThreadPostBoxComponent, selectors: [["app-thread-post-box"]], inputs: { isMainPost: [1, "isMainPost"], threadPost: [1, "threadPost"], index: [1, "index"], isLast: [1, "isLast"], charLimit: [1, "charLimit"] }, decls: 16, vars: 19, consts: [[1, "flex", "gap-3"], [1, "flex", "flex-col", "items-center"], [1, "flex", "items-center", "justify-center", "size-9", "rounded-lg", "border", "text-sm", "font-semibold", "shrink-0", 3, "ngClass"], [1, "w-0.5", "flex-1", "bg-grey-100", "rounded-full", "my-1"], [1, "flex-1", "mb-4"], [1, "relative", "border", "border-grey-100", "rounded-lg", "overflow-hidden", 3, "ngClass"], [1, "w-full", "min-h-28", "p-3", "pb-8", "border-none", "outline-0", "resize-none", "text-sm", "font-sans", 3, "ngModelChange", "ngModel", "placeholder"], [1, "absolute", "bottom-2", "right-3", "flex", "items-center", "gap-3"], ["tooltipPosition", "top", 1, "text-xs", 3, "ngClass", "tooltip"], [1, "py-2", "relative", "h-32"], [1, "absolute", "h-full", "w-full", "top-2", "left-0"], [3, "valueChange", "editWithCanva", "source", "size", "scopedLoading", "showUploadLabel"]], template: function ThreadPostBoxComponent_Template(rf, ctx) {
13520    if (rf & 1) {
13521      \u0275\u0275elementStart(0, "div", 0)(1, "div", 1)(2, "span", 2);
13522      \u0275\u0275text(3);
13523      \u0275\u0275elementEnd();
13524      \u0275\u0275conditionalCreate(4, ThreadPostBoxComponent_Conditional_4_Template, 1, 0, "div", 3);
13525      \u0275\u0275elementEnd();
13526      \u0275\u0275elementStart(5, "article", 4)(6, "div", 5)(7, "textarea", 6);
13527      \u0275\u0275listener("ngModelChange", function ThreadPostBoxComponent_Template_textarea_ngModelChange_7_listener($event) {
13528        return ctx.onMessageChange($event);
13529      });
13530      \u0275\u0275elementEnd();
13531      \u0275\u0275elementStart(8, "footer", 7);
13532      \u0275\u0275conditionalCreate(9, ThreadPostBoxComponent_Conditional_9_Template, 3, 6, "span", 8);
13533      \u0275\u0275elementStart(10, "span", 8);
13534      \u0275\u0275pipe(11, "translate");
13535      \u0275\u0275text(12);
13536      \u0275\u0275elementEnd()()();
13537      \u0275\u0275elementStart(13, "section", 9)(14, "section", 10)(15, "ui-multimedia-list", 11);
13538      \u0275\u0275listener("valueChange", function ThreadPostBoxComponent_Template_ui_multimedia_list_valueChange_15_listener() {
13539        return ctx.onMultimediaChange();
13540      })("editWithCanva", function ThreadPostBoxComponent_Template_ui_multimedia_list_editWithCanva_15_listener($event) {
13541        return ctx.store.editWithCanva($event);
13542      });
13543      \u0275\u0275elementEnd()()()()();
13544    }
13545    if (rf & 2) {
13546      \u0275\u0275advance(2);
13547      \u0275\u0275property("ngClass", ctx.isOverLimit() ? "border-red-500 text-red-500" : "border-grey-100 text-grey-500");
13548      \u0275\u0275advance();
13549      \u0275\u0275textInterpolate1(" ", ctx.index() + 1, " ");
13550      \u0275\u0275advance();
13551      \u0275\u0275conditional(!ctx.isLast() ? 4 : -1);
13552      \u0275\u0275advance(2);
13553      \u0275\u0275property("ngClass", \u0275\u0275pureFunction1(17, _c014, ctx.isOverLimit()));
13554      \u0275\u0275advance();
13555      \u0275\u0275property("ngModel", ctx.message())("placeholder", "");
13556      \u0275\u0275advance(2);
13557      \u0275\u0275conditional(ctx.isX() ? 9 : -1);
13558      \u0275\u0275advance();
13559      \u0275\u0275property("ngClass", ctx.isOverLimit() ? "text-red-500 font-semibold" : "text-grey-300")("tooltip", \u
135590275\u0275pipeBind1(11, 15, "MESSENGER.COUNTERS.CHARACTERS_TOOLTIP"));
13560      \u0275\u0275advance(2);
13561      \u0275\u0275textInterpolate2(" ", ctx.messageLength(), "/", ctx.charLimit(), " ");
13562      \u0275\u0275advance(3);
13563      \u0275\u0275property("source", ctx.postSource())("size", "size-24")("scopedLoading", true)("showUploadLabel", false);
13564    }
13565  }, dependencies: [NgClass, FormsModule, DefaultValueAccessor, NgControlStatus, NgModel, MultimediaListComponent, TooltipDirective, TranslatePipe], encapsulation: 2 });
13566};
13567(() => {
13568  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ThreadPostBoxComponent, [{
13569    type: Component,
13570    args: [{ selector: "app-thread-post-box", imports: [NgClass, FormsModule, MultimediaListComponent, TooltipDirective, TranslatePipe], template: `<div class="flex gap-3">
13571  <!-- Counter + connecting line -->
13572  <div class="flex flex-col items-center">
13573    <span
13574      class="flex items-center justify-center size-9 rounded-lg border text-sm font-semibold shrink-0"
13575      [ngClass]="isOverLimit() ? 'border-red-500 text-red-500' : 'border-grey-100 text-grey-500'"
13576    >
13577      {{ index() + 1 }}
13578    </span>
13579    @if (!isLast()) {
13580    <div class="w-0.5 flex-1 bg-grey-100 rounded-full my-1"></div>
13581    }
13582  </div>
13583
13584  <!-- Post content -->
13585  <article class="flex-1 mb-4">
13586    <div
13587      class="relative border border-grey-100 rounded-lg overflow-hidden"
13588      [ngClass]="{ 'border-red-500!': isOverLimit() }"
13589    >
13590      <textarea
13591        [ngModel]="message()"
13592        (ngModelChange)="onMessageChange($event)"
13593        class="w-full min-h-28 p-3 pb-8 border-none outline-0 resize-none text-sm font-sans"
13594        [placeholder]="''"
13595      ></textarea>
13596
13597      <footer class="absolute bottom-2 right-3 flex items-center gap-3">
13598        @if (isX()) {
13599          <span
13600            class="text-xs"
13601            [ngClass]="cashtagCount() > cashtagMax ? 'text-red-500 font-semibold' : 'text-grey-300'"
13602            [tooltip]="'MESSENGER.COUNTERS.CASHTAGS_TOOLTIP' | translate"
13603            tooltipPosition="top"
13604          >
13605            $ {{ cashtagCount() }}/{{ cashtagMax }}
13606          </span>
13607        }
13608        <span
13609          class="text-xs"
13610          [ngClass]="isOverLimit() ? 'text-red-500 font-semibold' : 'text-grey-300'"
13611          [tooltip]="'MESSENGER.COUNTERS.CHARACTERS_TOOLTIP' | translate"
13612          tooltipPosition="top"
13613        >
13614          {{ messageLength() }}/{{ charLimit() }}
13615        </span>
13616      </footer>
13617    </div>
13618
13619    <!-- Multimedia -->
13620    <section class="py-2 relative h-32">
13621      <section class="absolute h-full w-full top-2 left-0">
13622        <ui-multimedia-list
13623          (valueChange)="onMultimediaChange()"
13624          (editWithCanva)="store.editWithCanva($event)"
13625          [source]="postSource()"
13626          [size]="'size-24'"
13627          [scopedLoading]="true"
13628          [showUploadLabel]="false"
13629        />
13630      </section>
13631    </section>
13632  </article>
13633</div>
13634` }]
13635  }], null, null);
13636})();
13637(() => {
13638  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(ThreadPostBoxComponent, { className: "ThreadPostBoxComponent", filePath: "libs/socialgest/messenger/src/presenter/views/thread/thread-post-box/thread-post-box.component.ts", lineNumber: 14 });
13639})();
13640
13641// libs/socialgest/messenger/src/presenter/views/thread/thread-editor.component.ts
13642var _c015 = (a0, a1) => ({ total: a0, date: a1 });
13643var _c18 = (a0) => ({ count: a0 });
13644var _forTrack06 = ($index, $item) => $item.id;
13645function ThreadEditorComponent_For_4_Template(rf, ctx) {
13646  if (rf & 1) {
13647    \u0275\u0275element(0, "app-thread-post-box", 3);
13648  }
13649  if (rf & 2) {
13650    const post_r1 = ctx.$implicit;
13651    const \u0275$index_7_r2 = ctx.$index;
13652    const \u0275$count_7_r3 = ctx.$count;
13653    const ctx_r3 = \u0275\u0275nextContext();
13654    \u0275\u0275property("threadPost", post_r1)("index", \u0275$index_7_r2 + 1)("isLast", \u0275$index_7_r2 === \u0275$count_7_r3 - 1)("charLimit", ctx_r3.charLimit());
13655  }
13656}
13657function ThreadEditorComponent_Conditional_7_Template(rf, ctx) {
13658  if (rf & 1) {
13659    \u0275\u0275elementStart(0, "span", 6);
13660    \u0275\u0275pipe(1, "translate");
13661    \u0275\u0275pipe(2, "translate");
13662    \u0275\u0275element(3, "ui-icon", 10);
13663    \u0275\u0275text(4);
13664    \u0275\u0275elementEnd();
13665  }
13666  if (rf & 2) {
13667    const ctx_r3 = \u0275\u0275nextContext();
13668    \u0275\u0275property("ngClass", ctx_r3.urlQuotaLevel() === "exhausted" ? "text-red-500" : ctx_r3.urlQuotaLevel() === "warning" ? "text-[#E9821B]" : "text-grey-300")("tooltip", \u0275\u0275pipeBind2(1, 4, "MESSENGER.COUNTERS.URL_QUOTA_TOOLTIP", \u0275\u0275pureFunction2(10, _c015, ctx_r3.urlQuotaTotal(), ctx_r3.urlQuotaResetLabel())) + " " + \u0275\u0275pipeBind2(2, 7, "MESSENGER.COUNTERS.URL_QUOTA_THREAD", \u0275\u0275pureFunction1(13, _c18, ctx_r3.pendingUnits())));
13669    \u0275\u0275advance(4);
13670    \u0275\u0275textInterpolate2(" ", ctx_r3.urlQuotaUsed(), "/", ctx_r3.urlQuotaTotal(), " ");
13671  }
13672}
13673var ThreadEditorComponent = class _ThreadEditorComponent extends BaseComponent {
13674  store = inject(MessengerStore);
13675  urlQuota = inject(UrlQuotaService);
13676  /**
13677   * The date this publication is being scheduled for, or null for "now".
13678   *
13679   * The quota is per billing cycle, so a post set for December is charged to
13680   * December. Reading today's cycle refused posts the API would have accepted.
13681   */
13682  scheduledAt = computed(() => {
13683    const scheduler = this.store.post().scheduler;
13684    return scheduler.is.present ? scheduler.first.date ?? null : null;
13685  });
13686  posts = computed(() => this.store.post().threadPosts.items);
13687  isX = computed(() => this.store.userType() === UserType.X);
13688  // Cada tweet del hilo con enlace gasta 1 del cupo. Con hasXLink y no con
13689  // $string.urls: esa excluye los linkedin.com/company/... por el acortador.
13690  urlPostCount = computed(() => {
13691    const post = this.store.post();
13692    const main2 = hasXLink(post.message.value) ? 1 : 0;
13693    const thread = post.threadPosts.items.filter((p) => hasXLink(p.message)).length;
13694    return main2 + thread;
13695  });
13696  /**
13697   * What this thread will take: one per tweet carrying a link, times the X
13698   * profiles it goes to. The same figure the publish button is gated on, read
13699   * from the same place, so the counter and the button can never disagree.
13700   */
13701  pendingUnits = computed(() => this.store.post().urlQuotaUnits());
13702  urlQuotaUsed = computed(() => this.urlQuota.usedAt(this.scheduledAt()) + this.pendingUnits());
13703  urlQuotaTotal = computed(() => this.urlQuota.totalAt(this.scheduledAt()));
13704  urlQuotaResetLabel = computed(() => this.urlQuota.resetLabelAt(this.scheduledAt()));
13705  urlQuotaLevel = computed(() => this.urlQuota.levelAt(this.scheduledAt(), this.urlQuotaUsed()));
13706  showUrlQuota = computed(() => this.isX() && this.urlQuota.loadedAt(this.scheduledAt()) && this.urlPostCount() > 0);
13707  // Moving the date to another month asks for that month's quota.
13708  loadQuotaForDate = effect(() => {
13709    void this.urlQuota.ensureLoadedAt(this.scheduledAt());
13710  });
13711  isThreadsPlatform = computed(() => this.store.userType() === UserType.THREADS);
13712  charLimit = computed(() => Post.maxCharacters(this.store.userType(), this.store.post()));
13713  isMultimediaLoading = signal(false);
13714  canInsert = computed(() => this.store.post().threadPosts.canInsert && !this.isMultimediaLoading());
13715  canRemove = computed(() => this.store.post().threadPosts.canRemove && !this.isMultimediaLoading());
13716  ngOnInit() {
13717    this.bus.on(UploaderLoadingEvent).pipe(this.unsubscribe()).subscribe(({ isLoading }) => {
13718      this.isMultimediaLoading.set(isLoading);
13719    });
13720  }
13721  addPost() {
13722    this.store.post().threadPosts.insert();
13723    this.store.refresh();
13724  }
13725  removePost() {
13726    this.store.post().threadPosts.removeLast();
13727    this.store.refresh();
13728  }
13729  static \u0275fac = /* @__PURE__ */ (() => {
13730    let \u0275ThreadEditorComponent_BaseFactory;
13731    return function ThreadEditorComponent_Factory(__ngFactoryType__) {
13732      return (\u0275ThreadEditorComponent_BaseFactory || (\u0275ThreadEditorComponent_BaseFactory = \u0275\u0275getInheritedFactory(_ThreadEditorComponent)))(__ngFactoryType__ || _ThreadEditorComponent);
13733    };
13734  })();
13735  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _ThreadEditorComponent, selectors: [["app-thread"]], features: [\u0275\u0275InheritDefinitionFeature], decls: 15, vars: 13, consts: [[1, "h-full", "grid", "grid-rows-[1fr_auto]"], [1, "overflow-y-auto", "max-h-[27rem]", "pr-1", 2, "scrollbar-width", "none"], [3, "isMainPost", "index", "isLast", "charLimit"], [3, "threadPost", "index", "isLast", "charLimit"], [1, "flex", "items-center", "justify-between", "gap-4", "py-4", "border-t", "border-grey-50"], [1, "flex", "items-center", "min-w-0"], ["tooltipPosition", "top", 1, "text-sm", "font-sans", "inline-flex", "items-center", "gap-1", 3, "ngClass", "tooltip"], [1, "flex", "items-center", "gap-4"], ["tabindex", "0", 1, "px-4", "py-2", "rounded-lg", "border", "border-grey-100", "text-sm", "font-semibold", "disabled:opacity-40", "cursor-pointer", "transition-colors", "hover:bg-grey-50", 3, "click", "disabled"], ["tabindex", "0", 1, "px-4", "py-2", "rounded-lg", "bg-primary-500", "text-white", "text-sm", "font-semibold", "disabled:opacity-40", "cursor-pointer", 3, "click", "disabled"], ["name", "link-2", "styleClass", "size-3.5"]], template: function ThreadEditorComponent_Template(rf, ctx) {
13736    if (rf & 1) {
13737      \u0275\u0275elementStart(0, "article", 0)(1, "section", 1);
13738      \u0275\u0275element(2, "app-thread-post-box", 2);
13739      \u0275\u0275repeaterCreate(3, ThreadEditorComponent_For_4_Template, 1, 4, "app-thread-post-box", 3, _forTrack06);
13740      \u0275\u0275elementEnd();
13741      \u0275\u0275elementStart(5, "footer", 4)(6, "div", 5);
13742      \u0275\u0275conditionalCreate(7, ThreadEditorComponent_Conditional_7_Template, 5, 15, "span", 6);
13743      \u0275\u0275elementEnd();
13744      \u0275\u0275elementStart(8, "div", 7)(9, "button", 8);
13745      \u0275\u0275listener("click", function ThreadEditorComponent_Template_button_click_9_listener() {
13746        return ctx.removePost();
13747      });
13748      \u0275\u0275text(10);
13749      \u0275\u0275pipe(11, "translate");
13750      \u0275\u0275elementEnd();
13751      \u0275\u0275elementStart(12, "button", 9);
13752      \u0275\u0275listener("click", function ThreadEditorComponent_Template_button_click_12_listener() {
13753        return ctx.addPost();
13754      });
13755      \u0275\u0275text(13);
13756      \u0275\u0275pipe(14, "translate");
13757      \u0275\u0275elementEnd()()()();
13758    }
13759    if (rf & 2) {
13760      \u0275\u0275advance(2);
13761      \u0275\u0275property("isMainPost", true)("index", 0)("isLast", ctx.posts().length === 0)("charLimit", ctx.charLimit());
13762      \u0275\u0275advance();
13763      \u0275\u0275repeater(ctx.posts());
13764      \u0275\u0275advance(4);
13765      \u0275\u0275conditional(ctx.showUrlQuota() ? 7 : -1);
13766      \u0275\u0275advance(2);
13767      \u0275\u0275property("disabled", !ctx.canRemove());
13768      \u0275\u0275advance();
13769      \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(11, 9, ctx.isThreadsPlatform() ? "MESSENGER.THREAD.DELETE_POST" : "MESSENGER.THREAD.DELETE_TWEET"), " ");
13770      \u0275\u0275advance(2);
13771      \u0275\u0275property("disabled", !ctx.canInsert());
13772      \u0275\u0275advance();
13773      \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(14, 11, ctx.isThreadsPlatform() ? "MESSENGER.THREAD.ADD_POST" : "MESSENGER.THREAD.ADD_TWEET"), " ");
13774    }
13775  }, dependencies: [NgClass, TranslatePipe, ThreadPostBoxComponent, IconComponent, TooltipDirective], encapsulation: 2 });
13776};
13777(() => {
13778  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(ThreadEditorComponent, [{
13779    type: Component,
13780    args: [{ selector: "app-thread", imports: [NgClass, TranslatePipe, ThreadPostBoxComponent, IconComponent, TooltipDirective], template: `<article class="h-full grid grid-rows-[1fr_auto]">
13781  <section class="overflow-y-auto max-h-[27rem] pr-1" style="scrollbar-width: none">
13782    <!-- Hilo 1: Post principal (message + multimedia del store) -->
13783    <app-thread-post-box [isMainPost]="true" [index]="0" [isLast]="posts().length === 0" [charLimit]="charLimit()" />
13784
13785    <!-- Hilos adicionales (2+) -->
13786    @for (post of posts(); track post.id; let i = $index; let last = $last) {
13787    <app-thread-post-box [threadPost]="post" [index]="i + 1" [isLast]="last" [charLimit]="charLimit()" />
13788    }
13789  </section>
13790
13791  <footer class="flex items-center justify-between gap-4 py-4 border-t border-grey-50">
13792    <div class="flex items-center min-w-0">
13793      @if (showUrlQuota()) {
13794        <span
13795          class="text-sm font-sans inline-flex items-center gap-1"
13796          [ngClass]="
13797            urlQuotaLevel() === 'exhausted'
13798              ? 'text-red-500'
13799              : urlQuotaLevel() === 'warning'
13800                ? 'text-[#E9821B]'
13801                : 'text-grey-300'
13802          "
13803          [tooltip]="
13804            ('MESSENGER.COUNTERS.URL_QUOTA_TOOLTIP'
13805              | translate: { total: urlQuotaTotal(), date: urlQuotaResetLabel() }) +
13806            ' ' +
13807            ('MESSENGER.COUNTERS.URL_QUOTA_THREAD' | translate: { count: pendingUnits() })
13808          "
13809          tooltipPosition="top"
13810        >
13811          <ui-icon name="link-2" styleClass="size-3.5" />
13812          {{ urlQuotaUsed() }}/{{ urlQuotaTotal() }}
13813        </span>
13814      }
13815    </div>
13816    <div class="flex items-center gap-4">
13817      <button
13818        (click)="removePost()"
13819        [disabled]="!canRemove()"
13820        class="px-4 py-2 rounded-lg border border-grey-100 text-sm font-semibold disabled:opacity-40 cursor-pointer transition-colors hover:bg-grey-50"
13821        tabindex="0"
13822      >
13823        {{ (isThreadsPlatform() ? 'MESSENGER.THREAD.DELETE_POST' : 'MESSENGER.THREAD.DELETE_TWEET') | translate }}
13824      </button>
13825      <button
13826        (click)="addPost()"
13827        [disabled]="!canInsert()"
13828        class="px-4 py-2 rounded-lg bg-primary-500 text-white text-sm font-semibold disabled:opacity-40 cursor-pointer"
13829        tabindex="0"
13830      >
13831        {{ (isThreadsPlatform() ? 'MESSENGER.THREAD.ADD_POST' : 'MESSENGER.THREAD.ADD_TWEET') | translate }}
13832      </button>
13833    </div>
13834  </footer>
13835</article>
13836` }]
13837  }], null, null);
13838})();
13839(() => {
13840  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(ThreadEditorComponent, { className: "ThreadEditorComponent", filePath: "libs/socialgest/messenger/src/presenter/views/thread/thread-editor.component.ts", lineNumber: 15 });
13841})();
13842
13843// libs/socialgest/messenger/src/presenter/views/youtube/youtube.component.ts
13844function YoutubeComponent_For_15_Template(rf, ctx) {
13845  if (rf & 1) {
13846    const _r1 = \u0275\u0275getCurrentView();
13847    \u0275\u0275elementStart(0, "ui-chip", 13);
13848    \u0275\u0275listener("remove", function YoutubeComponent_For_15_Template_ui_chip_remove_0_listener() {
13849      const tag_r2 = \u0275\u0275restoreView(_r1).$implicit;
13850      const ctx_r2 = \u0275\u0275nextContext();
13851      return \u0275\u0275resetView(ctx_r2.removeTag(tag_r2));
13852    });
13853    \u0275\u0275elementEnd();
13854  }
13855  if (rf & 2) {
13856    const tag_r2 = ctx.$implicit;
13857    \u0275\u0275property("label", tag_r2)("showIcon", false);
13858  }
13859}
13860var YoutubeComponent = class _YoutubeComponent {
13861  maxTitleLength = YoutubeTitleLengthValidation.MAX_LENGTH;
13862  store = inject(MessengerStore);
13863  toaster = inject(SonnerToasterService);
13864  tagInput = signal("");
13865  title = computed(() => this.store.post().options.youtube.title);
13866  tags = computed(() => this.store.post().options.youtube.tags);
13867  isTitleOverLimit = computed(() => this.title().length >= this.maxTitleLength);
13868  onTitleChange(value) {
13869    this.store.post().options.youtube.set.title(value);
13870    this.store.refresh();
13871  }
13872  addTag(event) {
13873    if (event.key !== "Enter")
13874      return;
13875    const value = this.tagInput().trim();
13876    if (!value)
13877      return;
13878    this.store.post().options.youtube.addTag(value);
13879    this.tagInput.set("");
13880    this.store.refresh();
13881  }
13882  removeTag(tag) {
13883    this.store.post().options.youtube.removeTag(tag);
13884    this.store.refresh();
13885  }
13886  onMultimediaChange() {
13887    const last = this.store.post().multimediaList.first;
13888    if (last?.isImage()) {
13889      this.store.post().multimediaList.mutable.remove(last);
13890      this.toaster.warning("MESSENGER.YOUTUBE.ONLY_VIDEOS");
13891    }
13892    this.store.refresh();
13893  }
13894  static \u0275fac = function YoutubeComponent_Factory(__ngFactoryType__) {
13895    return new (__ngFactoryType__ || _YoutubeComponent)();
13896  };
13897  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _YoutubeComponent, selectors: [["app-youtube"]], decls: 23, vars: 23, consts: [[1, "h-full", "grid", "grid-rows-[auto_auto_auto_1fr_auto]", "gap-4", "pt-2"], [1, "flex", "flex-col", "gap-1"], [1, "text-sm", "font-bold", "text-grey-500"], [1, "relative"], [3, "ngModelChange", "ngModel", "placeholder", "styleClass"], [1, "absolute", "right-3", "top-1/2", "-translate-y-1/2", "text-xs", 3, "ngClass"], [1, "p-inputtext", "flex", "flex-wrap", "items-center", "gap-2", "w-full"], [3, "label", "showIcon"], [1, "flex-1", "min-w-20", "border-none", "outline-0", "bg-transparent", "p-0", 3, "ngModelChange", "keydown", "ngModel", "placeholder"], [1, "grid", "grid-cols-[auto_1fr]", "gap-4", "min-h-56"], ["styleClass", "gap-0!", 1, "block", "size-full", 3, "valueChange", "editWithCanva", "source", "size", "accept", "multiple"], [1, "p-1.5"], [3, "placeholder"], [3, "remove", "label", "showIcon"]], template: function YoutubeComponent_Template(rf, ctx) {
13898    if (rf & 1) {
13899      \u0275\u0275elementStart(0, "article", 0)(1, "section", 1)(2, "span", 2);
13900      \u0275\u0275text(3);
13901      \u0275\u0275pipe(4, "translate");
13902      \u0275\u0275elementEnd();
13903      \u0275\u0275elementStart(5, "div", 3)(6, "ui-input-text", 4);
13904      \u0275\u0275listener("ngModelChange", function YoutubeComponent_Template_ui_input_text_ngModelChange_6_listener($event) {
13905        return ctx.onTitleChange($event);
13906      });
13907      \u0275\u0275elementEnd();
13908      \u0275\u0275elementStart(7, "span", 5);
13909      \u0275\u0275text(8);
13910      \u0275\u0275elementEnd()()();
13911      \u0275\u0275elementStart(9, "section", 1)(10, "span", 2);
13912      \u0275\u0275text(11);
13913      \u0275\u0275pipe(12, "translate");
13914      \u0275\u0275elementEnd();
13915      \u0275\u0275elementStart(13, "div", 6);
13916      \u0275\u0275repeaterCreate(14, YoutubeComponent_For_15_Template, 1, 2, "ui-chip", 7, \u0275\u0275repeaterTrackByIdentity);
13917      \u0275\u0275elementStart(16, "input", 8);
13918      \u0275\u0275pipe(17, "translate");
13919      \u0275\u0275listener("ngModelChange", function YoutubeComponent_Template_input_ngModelChange_16_listener($event) {
13920        return ctx.tagInput.set($event);
13921      })("keydown", function YoutubeComponent_Template_input_keydown_16_listener($event) {
13922        return ctx.addTag($event);
13923      });
13924      \u0275\u0275elementEnd()()();
13925      \u0275\u0275elementStart(18, "section", 9)(19, "ui-multimedia-list", 10);
13926      \u0275\u0275listener("valueChange", function YoutubeComponent_Template_ui_multimedia_list_valueChange_19_listener() {
13927        return ctx.onMultimediaChange();
13928      })("editWithCanva", function YoutubeComponent_Template_ui_multimedia_list_editWithCanva_19_listener($event) {
13929        return ctx.store.editWithCanva($event);
13930      });
13931      \u0275\u0275elementEnd();
13932      \u0275\u0275elementStart(20, "div", 11);
13933      \u0275\u0275element(21, "app-textarea", 12);
13934      \u0275\u0275pipe(22, "translate");
13935      \u0275\u0275elementEnd()()();
13936    }
13937    if (rf & 2) {
13938      \u0275\u0275advance(3);
13939      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(4, 15, "MESSENGER.YOUTUBE.TITLE"));
13940      \u0275\u0275advance(3);
13941      \u0275\u0275property("ngModel", ctx.title())("placeholder", "MESSENGER.YOUTUBE.TITLE_PLACEHOLDER")("styleClass", "pr-14! " + (ctx.isTitleOverLimit() ? "ng-invalid ng-dirty" : ""));
13942      \u0275\u0275advance();
13943      \u0275\u0275property("ngClass", ctx.isTitleOverLimit() ? "text-red-500" : "text-grey-300");
13944      \u0275\u0275advance();
13945      \u0275\u0275textInterpolate2(" ", ctx.title().length, "/", ctx.maxTitleLength, " ");
13946      \u0275\u0275advance(3);
13947      \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(12, 17, "MESSENGER.YOUTUBE.TAGS"));
13948      \u0275\u0275advance(3);
13949      \u0275\u0275repeater(ctx.tags());
13950      \u0275\u0275advance(2);
13951      \u0275\u0275property("ngModel", ctx.tagInput())("placeholder", ctx.tags().length === 0 ? \u0275\u0275pipeBind1(17, 19, "MESSENGER.YOUTUBE.TAGS_PLACEHOLDER") : "");
13952      \u0275\u0275advance(3);
13953      \u0275\u0275property("source", ctx.store)("size", "size-72")("accept", "video/*")("multiple", false);
13954      \u0275\u0275advance(2);
13955      \u0275\u0275property("placeholder", \u0275\u0275pipeBind1(22, 21, "MESSENGER.YOUTUBE.DESCRIPTION"));
13956    }
13957  }, dependencies: [
13958    CommonModule,
13959    NgClass,
13960    FormsModule,
13961    DefaultValueAccessor,
13962    NgControlStatus,
13963    NgModel,
13964    TranslatePipe,
13965    InputTextComponent,
13966    ChipComponent,
13967    MultimediaListComponent,
13968    TextareaComponent2
13969  ], encapsulation: 2 });
13970};
13971(() => {
13972  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(YoutubeComponent, [{
13973    type: Component,
13974    args: [{ selector: "app-youtube", imports: [
13975      CommonModule,
13976      FormsModule,
13977      TranslatePipe,
13978      InputTextComponent,
13979      ChipComponent,
13980      MultimediaListComponent,
13981      TextareaComponent2
13982    ], template: `<article class="h-full grid grid-rows-[auto_auto_auto_1fr_auto] gap-4 pt-2">
13983  <!-- Title -->
13984  <section class="flex flex-col gap-1">
13985    <span class="text-sm font-bold text-grey-500">{{ 'MESSENGER.YOUTUBE.TITLE' | translate }}</span>
13986    <div class="relative">
13987      <ui-input-text
13988        [ngModel]="title()"
13989        (ngModelChange)="onTitleChange($event)"
13990        [placeholder]="'MESSENGER.YOUTUBE.TITLE_PLACEHOLDER'"
13991        [styleClass]="'pr-14! ' + (isTitleOverLimit() ? 'ng-invalid ng-dirty' : '')"
13992      />
13993      <span
13994        class="absolute right-3 top-1/2 -translate-y-1/2 text-xs"
13995        [ngClass]="isTitleOverLimit() ? 'text-red-500' : 'text-grey-300'"
13996      >
13997        {{ title().length }}/{{ maxTitleLength }}
13998      </span>
13999    </div>
14000  </section>
14001
14002  <!-- Tags -->
14003  <section class="flex flex-col gap-1">
14004    <span class="text-sm font-bold text-grey-500">{{ 'MESSENGER.YOUTUBE.TAGS' | translate }}</span>
14005    <div class="p-inputtext flex flex-wrap items-center gap-2 w-full">
14006      @for(tag of tags(); track tag) {
14007      <ui-chip [label]="tag" [showIcon]="false" (remove)="removeTag(tag)" />
14008      }
14009      <input
14010        [ngModel]="tagInput()"
14011        (ngModelChange)="tagInput.set($event)"
14012        (keydown)="addTag($event)"
14013        [placeholder]="tags().length === 0 ? ('MESSENGER.YOUTUBE.TAGS_PLACEHOLDER' | translate) : ''"
14014        class="flex-1 min-w-20 border-none outline-0 bg-transparent p-0"
14015      />
14016    </div>
14017  </section>
14018
14019  <!-- Thumbnail + Description -->
14020  <section class="grid grid-cols-[auto_1fr] gap-4 min-h-56">
14021    <ui-multimedia-list
14022      (valueChange)="onMultimediaChange()"
14023      (editWithCanva)="store.editWithCanva($event)"
14024      [source]="store"
14025      [size]="'size-72'"
14026      [accept]="'video/*'"
14027      [multiple]="false"
14028      styleClass="gap-0!"
14029      class="block size-full"
14030    />
14031
14032    <div class="p-1.5">
14033      <app-textarea [placeholder]="'MESSENGER.YOUTUBE.DESCRIPTION' | translate" />
14034    </div>
14035  </section>
14036</article>
14037` }]
14038  }], null, null);
14039})();
14040(() => {
14041  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(YoutubeComponent, { className: "YoutubeComponent", filePath: "libs/socialgest/messenger/src/presenter/views/youtube/youtube.component.ts", lineNumber: 23 });
14042})();
14043
14044// libs/socialgest/messenger/src/presenter/views/messenger.component.ts
14045var _c016 = (a0) => ({ "pointer-events-none": a0 });
14046var _c19 = (a0) => ({ "w-0! opacity-0 overflow-hidden": a0 });
14047var _c22 = (a0) => ({ "w-0! opacity-0": a0 });
14048function MessengerComponent_Conditional_1_Template(rf, ctx) {
14049  if (rf & 1) {
14050    const _r1 = \u0275\u0275getCurrentView();
14051    \u0275\u0275elementStart(0, "section", 0)(1, "ui-empty-state", 2);
14052    \u0275\u0275listener("connectClick", function MessengerComponent_Conditional_1_Template_ui_empty_state_connectClick_1_listener() {
14053      \u0275\u0275restoreView(_r1);
14054      const ctx_r1 = \u0275\u0275nextContext();
14055      return \u0275\u0275resetView(ctx_r1.dialogRef()().close());
14056    });
14057    \u0275\u0275elementEnd()();
14058  }
14059  if (rf & 2) {
14060    const ctx_r1 = \u0275\u0275nextContext();
14061    \u0275\u0275advance();
14062    \u0275\u0275property("label", "MESSENGER.EMPTY.TITLE")("description", "MESSENGER.EMPTY.DESCRIPTION")("icon", "circle-plus")("highlights", ctx_r1.messengerHighlights)("fullWidth", true);
14063  }
14064}
14065function MessengerComponent_Conditional_2_Conditional_17_Template(rf, ctx) {
14066  if (rf & 1) {
14067    \u0275\u0275element(0, "app-personalize-toggle");
14068  }
14069}
14070function MessengerComponent_Conditional_2_Conditional_19_Template(rf, ctx) {
14071  if (rf & 1) {
14072    \u0275\u0275element(0, "app-tab-list");
14073  }
14074}
14075function MessengerComponent_Conditional_2_Conditional_23_Template(rf, ctx) {
14076  if (rf & 1) {
14077    \u0275\u0275element(0, "app-youtube");
14078  }
14079}
14080function MessengerComponent_Conditional_2_Conditional_24_Template(rf, ctx) {
14081  if (rf & 1) {
14082    \u0275\u0275element(0, "app-thread");
14083  }
14084}
14085function MessengerComponent_Conditional_2_Conditional_25_Template(rf, ctx) {
14086  if (rf & 1) {
14087    \u0275\u0275element(0, "app-default");
14088  }
14089}
14090function MessengerComponent_Conditional_2_Conditional_27_Template(rf, ctx) {
14091  if (rf & 1) {
14092    \u0275\u0275element(0, "app-extras");
14093  }
14094}
14095function MessengerComponent_Conditional_2_Template(rf, ctx) {
14096  if (rf & 1) {
14097    const _r3 = \u0275\u0275getCurrentView();
14098    \u0275\u0275elementStart(0, "section", 1)(1, "article", 3)(2, "ui-ai-text-generator", 4);
14099    \u0275\u0275listener("valueChange", function MessengerComponent_Conditional_2_Template_ui_ai_text_generator_valueChange_2_listener($event) {
14100      \u0275\u0275restoreView(_r3);
14101      const ctx_r1 = \u0275\u0275nextContext();
14102      ctx_r1.store.post().set.message($event.trim());
14103      return \u0275\u0275resetView(ctx_r1.store.refresh());
14104    })("close", function MessengerComponent_Conditional_2_Template_ui_ai_text_generator_close_2_listener() {
14105      \u0275\u0275restoreView(_r3);
14106      const ctx_r1 = \u0275\u0275nextContext();
14107      return \u0275\u0275resetView(ctx_r1.store.toggleAiTextGenerator());
14108    });
14109    \u0275\u0275elementEnd()();
14110    \u0275\u0275elementStart(3, "article", 5);
14111    \u0275\u0275element(4, "app-shortener-panel");
14112    \u0275\u0275elementEnd();
14113    \u0275\u0275elementStart(5, "article", 6)(6, "section");
14114    \u0275\u0275element(7, "app-user-list");
14115    \u0275\u0275elementEnd();
14116    \u0275\u0275elementStart(8, "section", 7)(9, "div", 8)(10, "h2", 9)(11, "span", 10);
14117    \u0275\u0275text(12);
14118    \u0275\u0275pipe(13, "translate");
14119    \u0275\u0275elementEnd();
14120    \u0275\u0275text(14);
14121    \u0275\u0275pipe(15, "translate");
14122    \u0275\u0275elementEnd();
14123    \u0275\u0275elementStart(16, "div", 11);
14124    \u0275\u0275conditionalCreate(17, MessengerComponent_Conditional_2_Conditional_17_Template, 1, 0, "app-personalize-toggle");
14125    \u0275\u0275element(18, "app-campaign", 12);
14126    \u0275\u0275elementEnd()();
14127    \u0275\u0275conditionalCreate(19, MessengerComponent_Conditional_2_Conditional_19_Template, 1, 0, "app-tab-list");
14128    \u0275\u0275elementEnd();
14129    \u0275\u0275elementStart(20, "section");
14130    \u0275\u0275element(21, "app-alerts");
14131    \u0275\u0275elementEnd();
14132    \u0275\u0275elementStart(22, "section", 13);
14133    \u0275\u0275conditionalCreate(23, MessengerComponent_Conditional_2_Conditional_23_Template, 1, 0, "app-youtube")(24, MessengerComponent_Conditional_2_Conditional_24_Template, 1, 0, "app-thread")(25, MessengerComponent_Conditional_2_Conditional_25_Template, 1, 0, "app-default");
14134    \u0275\u0275elementEnd();
14135    \u0275\u0275elementStart(26, "section");
14136    \u0275\u0275conditionalCreate(27, MessengerComponent_Conditional_2_Conditional_27_Template, 1, 0, "app-extras");
14137    \u0275\u0275elementEnd()();
14138    \u0275\u0275elementStart(28, "article", 14);
14139    \u0275\u0275element(29, "app-scheduler");
14140    \u0275\u0275elementEnd()();
14141  }
14142  if (rf & 2) {
14143    const ctx_r1 = \u0275\u0275nextContext();
14144    const isSendingInstant_r4 = \u0275\u0275readContextLet(0);
14145    \u0275\u0275property("ngClass", \u0275\u0275pureFunction1(16, _c016, isSendingInstant_r4));
14146    \u0275\u0275advance();
14147    \u0275\u0275property("ngClass", \u0275\u0275pureFunction1(18, _c19, !ctx_r1.store.dialog().isAiTextGenerator));
14148    \u0275\u0275advance();
14149    \u0275\u0275property("copyField", ctx_r1.store.post().message.value)("selectedUserIds", ctx_r1.selectedUserIds());
14150    \u0275\u0275advance();
14151    \u0275\u0275property("ngClass", \u0275\u0275pureFunction1(20, _c22, !ctx_r1.store.dialog().isShortener));
14152    \u0275\u0275advance(9);
14153    \u0275\u0275textInterpolate(\u0275\u0275pipeBind1(13, 12, "GLOBAL.2"));
14154    \u0275\u0275advance(2);
14155    \u0275\u0275textInterpolate1(" ", \u0275\u0275pipeBind1(15, 14, "MESSENGER.ADD_CONTENT"), " ");
14156    \u0275\u0275advance(3);
14157    \u0275\u0275conditional(ctx_r1.store.post().userList.items.length > 1 && ctx_r1.store.post().is.new && !ctx_r1.store.post().has.cyclic ? 17 : -1);
14158    \u0275\u0275advance(2);
14159    \u0275\u0275conditional(ctx_r1.store.post().userList.has.items ? 19 : -1);
14160    \u0275\u0275advance(4);
14161    \u0275\u0275conditional(ctx_r1.store.post().userList.hasYoutube && ctx_r1.store.isUserType().youtube ? 23 : ctx_r1.store.isThread().activeForCurrentUser ? 24 : 25);
14162    \u0275\u0275advance(4);
14163    \u0275\u0275conditional(ctx_r1.store.post().userList.has.items ? 27 : -1);
14164    \u0275\u0275advance();
14165    \u0275\u0275property("ngClass", \u0275\u0275pureFunction1(22, _c19, !ctx_r1.store.post().userList.has.items && !ctx_r1.store.isInstantCompleted()));
14166  }
14167}
14168var MessengerComponent = class _MessengerComponent extends BaseComponent {
14169  post = input.required();
14170  dialogRef = input.required();
14171  store = inject(MessengerStore);
14172  userStore = inject(UserStore);
14173  cyclicListStore = inject(CyclicListStore);
14174  urlQuota = inject(UrlQuotaService);
14175  confirmDialog = inject(ConfirmDialogService);
14176  translateService = inject(TranslocoService);
14177  selectedUserIds = computed(() => this.store.post().userList.users.map((u) => u.id));
14178  hasChannels = computed(() => this.userStore.isLoading() || !this.userStore.userList().publishers.isEmpty);
14179  messengerHighlights = [
14180    { icon: "pencil-line", title: "MESSENGER.EMPTY.TIP_MULTI_TITLE", description: "MESSENGER.EMPTY.TIP_MULTI_DESC" },
14181    {
14182      icon: "calendar-clock",
14183      title: "MESSENGER.EMPTY.TIP_WHEN_TITLE",
14184      description: "MESSENGER.EMPTY.TIP_WHEN_DESC"
14185    },
14186    { icon: "eye", title: "MESSENGER.EMPTY.TIP_PREVIEW_TITLE", description: "MESSENGER.EMPTY.TIP_PREVIEW_DESC" }
14187  ];
14188  movSubscriber = inject(MovConversionSubscriber);
14189  hasOpenedSendingDialog = false;
14190  didKeepWorking = false;
14191  urlShortenerSubscriber = inject(UrlShortenerSubscriber);
14192  constructor() {
14193    super();
14194    this.movSubscriber.init();
14195    effect(() => {
14196      const post = this.post();
14197      untracked(() => {
14198        when(this.store.withPost(post)).map(() => {
14199          if (this.store.post().userList.isEmpty)
14200            this.store.post().multimediaList.markAllAsOk();
14201          if (!this.store.post().threadPosts.isEmpty) {
14202            if (this.store.post().userList.hasX)
14203              this.store.enableThread(UserType.X);
14204            if (this.store.post().userList.hasThreads)
14205              this.store.enableThread(UserType.THREADS);
14206          }
14207          if (this.store.post().has.cyclic)
14208            this.store.withCyclicList({ cyclicLocked: true });
14209          MentionDecoder.decode(this.store.post());
14210          this.loadAllMetadata();
14211        });
14212      });
14213    });
14214    effect(() => {
14215      const isSending = this.store.isSendingInstant();
14216      if (isSending && !this.hasOpenedSendingDialog) {
14217        this.hasOpenedSendingDialog = true;
14218        untracked(() => this.openSendingConfirmDialog());
14219      }
14220    });
14221    effect(() => {
14222      const pending = this.store.pendingInstantCount();
14223      const isUserListEmpty = this.store.post().userList.isEmpty;
14224      if (pending === 0 && isUserListEmpty && this.hasOpenedSendingDialog && !this.didKeepWorking) {
14225        untracked(() => {
14226          this.confirmDialog.close();
14227          const summaryId = `instant-pub-summary-${Date.now()}`;
14228          toast.custom(InstantPublicationSummaryToastComponent, {
14229            id: summaryId,
14230            componentProps: {
14231              id: summaryId,
14232              message: this.translateService.translate("MESSENGER.INSTANT_PUBLICATION.ALL_SUCCESS"),
14233              type: "all-success"
14234            },
14235            duration: Number.POSITIVE_INFINITY
14236          });
14237          this.bus.publish(new PostCompletedEvent(this.store.post()));
14238          sleep(3e3).then(() => this.dialogRef()().close());
14239        });
14240      }
14241    });
14242    effect(() => {
14243      this.store.post();
14244      untracked(() => this.loadAllMetadata());
14245    });
14246  }
14247  loadAllMetadata() {
14248    const post = this.store.post();
14249    const allLists = [post.multimediaList, ...post.threadPosts.items.map((tp) => tp.multimediaList)];
14250    const pending = allLists.flatMap((list) => list.items.filter((m) => !m.isLoaded()));
14251    if (pending.length === 0)
14252      return;
14253    Promise.allSettled(pending.map((m) => m.metadata.load())).then(() => this.store.refresh());
14254  }
14255  ngOnInit() {
14256    this.urlQuota.invalidate();
14257    this.dialogRef()().onClose.pipe(this.unsubscribe()).subscribe(() => {
14258      this.cyclicListStore.cyclicList().unselect.all();
14259      this.store.reset();
14260      this.movSubscriber.reset();
14261      this.urlShortenerSubscriber.reset();
14262      this.hasOpenedSendingDialog = false;
14263      this.didKeepWorking = false;
14264    });
14265    this.bus.once(PostCompletedEvent).pipe(this.unsubscribe()).subscribe(() => {
14266      sleep(5e3).then(() => this.dialogRef()().close());
14267    });
14268    this.bus.once(PostIdeaSavedEvent).pipe(this.unsubscribe()).subscribe(() => {
14269      this.dialogRef()().close();
14270    });
14271  }
14272  openSendingConfirmDialog() {
14273    this.confirmDialog.info({
14274      headerLabel: "MESSENGER.INSTANT_PUBLICATION.SENDING_HEADER",
14275      contentLabel: "MESSENGER.INSTANT_PUBLICATION.SENDING_CONTENT",
14276      acceptLabel: "MESSENGER.INSTANT_PUBLICATION.KEEP_WORKING",
14277      rejectLabel: "MESSENGER.INSTANT_PUBLICATION.WAIT_HERE",
14278      dismissableMask: false
14279    }).pipe(this.unsubscribe()).subscribe((result) => {
14280      result.mapRight(() => {
14281        this.didKeepWorking = true;
14282        this.dialogRef()().close();
14283      });
14284    });
14285  }
14286  ngOnDestroy() {
14287    this.userStore.userList().unselect.all();
14288  }
14289  static \u0275fac = function MessengerComponent_Factory(__ngFactoryType__) {
14290    return new (__ngFactoryType__ || _MessengerComponent)();
14291  };
14292  static \u0275cmp = /* @__PURE__ */ \u0275\u0275defineComponent({ type: _MessengerComponent, selectors: [["app-messenger"]], inputs: { post: [1, "post"], dialogRef: [1, "dialogRef"] }, features: [\u0275\u0275InheritDefinitionFeature], decls: 3, vars: 2, consts: [[1, "flex", "w-[64rem]", "max-w-[90vw]"], [1, "min-h-[50rem]", "flex", "gap-4", 3, "ngClass"], ["containerStyleClass", "pt-0! 4xl:pt-0!", 3, "connectClick", "label", "description", "icon", "highlights", "fullWidth"], [1, "w-[20rem]", "lg:w-[22rem]", "transition-all", "duration-300", "bg-white-500", "rounded-base", 3, "ngClass"], [3, "valueChange", "close", "copyField", "selectedUserIds"], [1, "relative", "w-[20rem]", "lg:w-[22rem]", "min-w-0", "overflow-hidden", "transition-all", "duration-300", "bg-white-500", "rounded-base", 3, "ngClass"], [1, "min-h-[44rem]", "w-[40rem]", "lg:w-[45rem]", "shrink-0", "grid", "grid-rows-[auto_auto_auto_1fr_auto]", "bg-white-500", "rounded-base", "px-6", "relative", "z-20"], [1, "flex", "flex-col", "gap-4", "pt-6", "pb-4"], [1, "flex", "items-center", "justify-between"], [1, "text-lg", "font-semibold"], [1, "text-grey-100", "mr-2"], [1, "flex", "items-center", "gap-3"], [1, "flex-1"], [1, "relative"], [1, "w-[21rem]", "lg:w-[23rem]", "transition-all", "duration-300", "bg-white-500", "rounded-base", 3, "ngClass"]], template: function MessengerComponent_Template(rf, ctx) {
14293    if (rf & 1) {
14294      \u0275\u0275declareLet(0);
14295      \u0275\u0275conditionalCreate(1, MessengerComponent_Conditional_1_Template, 2, 5, "section", 0)(2, MessengerComponent_Conditional_2_Template, 30, 24, "section", 1);
14296    }
14297    if (rf & 2) {
14298      \u0275\u0275storeLet(ctx.store.isSendingInstant());
14299      \u0275\u0275advance();
14300      \u0275\u0275conditional(!ctx.hasChannels() ? 1 : 2);
14301    }
14302  }, dependencies: [
14303    CommonModule,
14304    NgClass,
14305    TranslatePipe,
14306    AiTextGeneratorComponent,
14307    DefaultComponent,
14308    ThreadEditorComponent,
14309    YoutubeComponent,
14310    UserListComponent2,
14311    SchedulerComponent,
14312    CampaignComponent,
14313    TabListComponent,
14314    ExtrasComponent,
14315    AlertsComponent,
14316    PersonalizeToggleComponent,
14317    ShortenerPanelComponent,
14318    EmptyStateComponent
14319  ], encapsulation: 2 });
14320};
14321(() => {
14322  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MessengerComponent, [{
14323    type: Component,
14324    args: [{ selector: "app-messenger", imports: [
14325      CommonModule,
14326      TranslatePipe,
14327      AiTextGeneratorComponent,
14328      DefaultComponent,
14329      ThreadEditorComponent,
14330      YoutubeComponent,
14331      UserListComponent2,
14332      SchedulerComponent,
14333      CampaignComponent,
14334      TabListComponent,
14335      ExtrasComponent,
14336      AlertsComponent,
14337      PersonalizeToggleComponent,
14338      ShortenerPanelComponent,
14339      EmptyStateComponent
14340    ], template: `@let isSendingInstant = store.isSendingInstant();
14341@if (!hasChannels()) {
14342  <section class="flex w-[64rem] max-w-[90vw]">
14343    <ui-empty-state
14344      (connectClick)="dialogRef()().close()"
14345      [label]="'MESSENGER.EMPTY.TITLE'"
14346      [description]="'MESSENGER.EMPTY.DESCRIPTION'"
14347      [icon]="'circle-plus'"
14348      [highlights]="messengerHighlights"
14349      [fullWidth]="true"
14350      containerStyleClass="pt-0! 4xl:pt-0!"
14351    />
14352  </section>
14353} @else {
14354  <section class="min-h-[50rem] flex gap-4" [ngClass]="{ 'pointer-events-none': isSendingInstant }">
14355    <article
14356      class="w-[20rem] lg:w-[22rem] transition-all duration-300 bg-white-500 rounded-base"
14357      [ngClass]="{ 'w-0! opacity-0 overflow-hidden': !store.dialog().isAiTextGenerator }"
14358    >
14359      <ui-ai-text-generator
14360        (valueChange)="store.post().set.message($event.trim()); store.refresh()"
14361        (close)="store.toggleAiTextGenerator()"
14362        [copyField]="store.post().message.value"
14363        [selectedUserIds]="selectedUserIds()"
14364      />
14365    </article>
14366
14367    <article
14368      class="relative w-[20rem] lg:w-[22rem] min-w-0 overflow-hidden transition-all duration-300 bg-white-500 rounded-base"
14369      [ngClass]="{ 'w-0! opacity-0': !store.dialog().isShortener }"
14370    >
14371      <app-shortener-panel />
14372    </article>
14373
14374    <article
14375      class="min-h-[44rem] w-[40rem] lg:w-[45rem] shrink-0 grid grid-rows-[auto_auto_auto_1fr_auto] bg-white-500 rounded-base px-6 relative z-20"
14376    >
14377      <section>
14378        <app-user-list />
14379      </section>
14380
14381      <section class="flex flex-col gap-4 pt-6 pb-4">
14382        <div class="flex items-center justify-between">
14383          <h2 class="text-lg font-semibold">
14384            <span class="text-grey-100 mr-2">{{ 'GLOBAL.2' | translate }}</span>
14385            {{ 'MESSENGER.ADD_CONTENT' | translate }}
14386          </h2>
14387
14388          <div class="flex items-center gap-3">
14389            @if (store.post().userList.items.length > 1 && store.post().is.new && !store.post().has.cyclic) {
14390              <app-personalize-toggle />
14391            }
14392            <app-campaign class="flex-1" />
14393          </div>
14394        </div>
14395        @if (store.post().userList.has.items) {
14396          <app-tab-list />
14397        }
14398      </section>
14399
14400      <section>
14401        <app-alerts />
14402      </section>
14403
14404      <section class="relative">
14405        @if (store.post().userList.hasYoutube && store.isUserType().youtube) {
14406          <app-youtube />
14407        } @else if (store.isThread().activeForCurrentUser) {
14408          <app-thread />
14409        } @else {
14410          <app-default />
14411        }
14412      </section>
14413
14414      <section>
14415        @if (store.post().userList.has.items) {
14416          <app-extras />
14417        }
14418      </section>
14419    </article>
14420
14421    <article
14422      class="w-[21rem] lg:w-[23rem] transition-all duration-300 bg-white-500 rounded-base"
14423      [ngClass]="{ 'w-0! opacity-0 overflow-hidden': !store.post().userList.has.items && !store.isInstantCompleted() }"
14424    >
14425      <app-scheduler />
14426    </article>
14427  </section>
14428}
14429` }]
14430  }], () => [], null);
14431})();
14432(() => {
14433  (typeof ngDevMode === "undefined" || ngDevMode) && \u0275setClassDebugInfo(MessengerComponent, { className: "MessengerComponent", filePath: "libs/socialgest/messenger/src/presenter/views/messenger.component.ts", lineNumber: 47 });
14434})();
14435
14436// libs/socialgest/messenger/src/presenter/services/messenger.service.ts
14437var MessengerService2 = class _MessengerService {
14438  dialogService = inject(DialogService);
14439  store = inject(MessengerStore);
14440  /**
14441   * Open the composer for a post.
14442   *
14443   * @param options.promotedFromIdeaId Tweet id of the Kanban Idea this post is
14444   *   being promoted from. When provided, the idea is deleted once the post is
14445   *   successfully created (see MessengerSubscriber) so it isn't duplicated.
14446   */
14447  open(post = Post.empty(), options) {
14448    post.multimediaList.loadMetadata();
14449    post.userList.select.all();
14450    const dialogRef = this.dialogService.open(MessengerComponent, {
14451      inputValues: { post, dialogRef: () => dialogRef },
14452      dismissableMask: false,
14453      closable: true,
14454      modal: true,
14455      styleClass: "p-dialog--blur p-dialog--transparent p-dialog-header--hidden"
14456    });
14457    if (options?.promotedFromIdeaId)
14458      this.store.withPromotedFromIdea(options.promotedFromIdeaId);
14459  }
14460  static \u0275fac = function MessengerService_Factory(__ngFactoryType__) {
14461    return new (__ngFactoryType__ || _MessengerService)();
14462  };
14463  static \u0275prov = /* @__PURE__ */ \u0275\u0275defineInjectable({ token: _MessengerService, factory: _MessengerService.\u0275fac, providedIn: "root" });
14464};
14465(() => {
14466  (typeof ngDevMode === "undefined" || ngDevMode) && setClassMetadata(MessengerService2, [{
14467    type: Injectable,
14468    args: [{ providedIn: "root" }]
14469  }], null, null);
14470})();
14471
14472export {
14473  MessengerMapper,
14474  MessengerService2 as MessengerService,
14475  MessengerSubscriber
14476};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.