@dialstack/sdk-react 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +108 -0
  3. package/dist/ai-agent.cjs +2 -0
  4. package/dist/ai-agent.cjs.map +1 -0
  5. package/dist/ai-agent.d.cts +89 -0
  6. package/dist/ai-agent.d.ts +89 -0
  7. package/dist/ai-agent.mjs +2 -0
  8. package/dist/ai-agent.mjs.map +1 -0
  9. package/dist/call-history.cjs +2 -0
  10. package/dist/call-history.cjs.map +1 -0
  11. package/dist/call-history.d.cts +88 -0
  12. package/dist/call-history.d.ts +88 -0
  13. package/dist/call-history.mjs +2 -0
  14. package/dist/call-history.mjs.map +1 -0
  15. package/dist/call-logs.cjs +2 -0
  16. package/dist/call-logs.cjs.map +1 -0
  17. package/dist/call-logs.d.cts +104 -0
  18. package/dist/call-logs.d.ts +104 -0
  19. package/dist/call-logs.mjs +2 -0
  20. package/dist/call-logs.mjs.map +1 -0
  21. package/dist/dial-plan.cjs +2 -0
  22. package/dist/dial-plan.cjs.map +1 -0
  23. package/dist/dial-plan.d.cts +70 -0
  24. package/dist/dial-plan.d.ts +70 -0
  25. package/dist/dial-plan.mjs +2 -0
  26. package/dist/dial-plan.mjs.map +1 -0
  27. package/dist/index.cjs +2 -0
  28. package/dist/index.cjs.map +1 -0
  29. package/dist/index.d.cts +148 -0
  30. package/dist/index.d.ts +148 -0
  31. package/dist/index.mjs +2 -0
  32. package/dist/index.mjs.map +1 -0
  33. package/dist/onboarding.cjs +2 -0
  34. package/dist/onboarding.cjs.map +1 -0
  35. package/dist/onboarding.d.cts +49 -0
  36. package/dist/onboarding.d.ts +49 -0
  37. package/dist/onboarding.mjs +2 -0
  38. package/dist/onboarding.mjs.map +1 -0
  39. package/dist/phone-number-ordering.cjs +2 -0
  40. package/dist/phone-number-ordering.cjs.map +1 -0
  41. package/dist/phone-number-ordering.d.cts +83 -0
  42. package/dist/phone-number-ordering.d.ts +83 -0
  43. package/dist/phone-number-ordering.mjs +2 -0
  44. package/dist/phone-number-ordering.mjs.map +1 -0
  45. package/dist/phone-numbers.cjs +2 -0
  46. package/dist/phone-numbers.cjs.map +1 -0
  47. package/dist/phone-numbers.d.cts +77 -0
  48. package/dist/phone-numbers.d.ts +77 -0
  49. package/dist/phone-numbers.mjs +2 -0
  50. package/dist/phone-numbers.mjs.map +1 -0
  51. package/dist/softphone.cjs +2 -0
  52. package/dist/softphone.cjs.map +1 -0
  53. package/dist/softphone.d.cts +610 -0
  54. package/dist/softphone.d.ts +610 -0
  55. package/dist/softphone.mjs +2 -0
  56. package/dist/softphone.mjs.map +1 -0
  57. package/dist/voicemails.cjs +2 -0
  58. package/dist/voicemails.cjs.map +1 -0
  59. package/dist/voicemails.d.cts +128 -0
  60. package/dist/voicemails.d.ts +128 -0
  61. package/dist/voicemails.mjs +2 -0
  62. package/dist/voicemails.mjs.map +1 -0
  63. package/package.json +192 -0
@@ -0,0 +1,2 @@
1
+ import e,{useState as n,useEffect as o,memo as a,useRef as t,useMemo as l,useCallback as r,useImperativeHandle as i}from"react";import{Handle as d,Position as s,getStraightPath as c,getSmoothStepPath as p,BaseEdge as u,ReactFlowProvider as f,useReactFlow as g,useUpdateNodeInternals as b,useNodesState as m,useEdgesState as v,applyNodeChanges as _,MarkerType as h,ReactFlow as x,ConnectionLineType as y,Background as w,Controls as k}from"@xyflow/react";import{useDialstackComponents as E}from"@dialstack/sdk-react";import N from"dagre";import{Command as C}from"cmdk";import{parsePhoneNumberFromString as L,AsYouType as z}from"libphonenumber-js";import{createPortal as O}from"react-dom";function S(e,n,o,a){return new(o||(o=Promise))(function(t,l){function r(e){try{d(a.next(e))}catch(e){l(e)}}function i(e){try{d(a.throw(e))}catch(e){l(e)}}function d(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o(function(e){e(n)})).then(r,i)}d((a=a.apply(e,n||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const R="smoothstep";const T=({icon:n,label:o,timeout:a,subtitle:t})=>e.createElement("div",{className:"ds-dial-plan-node__header"},e.createElement("div",{className:"ds-dial-plan-node__icon"},n),e.createElement("span",{className:"ds-dial-plan-node__type-label"},o,void 0!==a&&e.createElement("span",{style:{textTransform:"none"}}," (",a,"s)")),t&&e.createElement("span",{className:"ds-dial-plan-node__name"},t)),j=({id:n,label:o})=>e.createElement("div",{className:"ds-dial-plan-node__exit-row"},e.createElement("span",{className:"ds-dial-plan-node__exit-label"},o),e.createElement(d,{type:"source",position:s.Right,id:n,className:"ds-dial-plan-handle ds-dial-plan-handle--next"})),A=({exits:n,locale:o})=>0===n.length?null:e.createElement(e.Fragment,null,n.map(n=>e.createElement(j,{key:n.id,id:n.id,label:n.localeExitKey&&(null==o?void 0:o.exits[n.localeExitKey])||n.label})));const F=({resourceId:n,onOpenResource:o,label:a})=>e.createElement("button",{type:"button",className:"ds-dial-plan-config-field__open-link",onClick:()=>o(n)},e.createElement("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),e.createElement("polyline",{points:"15 3 21 3 21 9"}),e.createElement("line",{x1:"10",y1:"14",x2:"21",y2:"3"})),a),I=({groups:a,value:r,loading:i=!1,placeholder:d="Search…",onSelect:s,onCreateResource:c,selectLabel:p="— Select —",noResultsLabel:u="No results found",loadingLabel:f="Loading…",createNewPrefix:g="+ Create new…",extensionLabel:b="Ext."})=>{const[m,v]=n(!1),[_,h]=n(""),x=t(null);o(()=>{var e;if(!m)return;const n=null===(e=x.current)||void 0===e?void 0:e.getRootNode(),o=n instanceof ShadowRoot||n instanceof Document?n:document,a=e=>function(e){"Escape"===e.key&&(v(!1),h(""))}(e),t=e=>function(e){x.current&&!x.current.contains(e.target)&&(v(!1),h(""))}(e);return o.addEventListener("keydown",a),o.addEventListener("mousedown",t),()=>{o.removeEventListener("keydown",a),o.removeEventListener("mousedown",t)}},[m]);const y=l(()=>{if(!r)return"";for(const e of a){const n=e.items.find(e=>e.id===r);if(n)return n.extension_number?`${n.name} (${b} ${n.extension_number})`:n.name}return""},[r,a,b]);if(!m)return e.createElement("button",{type:"button",className:"ds-resource-combobox__trigger",onClick:()=>v(!0)},e.createElement("span",{className:y?"":"ds-resource-combobox__trigger-placeholder"},y||p),e.createElement("svg",{className:"ds-resource-combobox__trigger-chevron",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("polyline",{points:"6 9 12 15 18 9"})));const w=a.some(e=>e.items.length>0);return e.createElement("div",{ref:x},e.createElement(C,{className:"ds-resource-combobox",shouldFilter:!0,loop:!0},e.createElement(C.Input,{className:"ds-resource-combobox__input",placeholder:d,value:_,onValueChange:h,autoFocus:!0}),e.createElement(C.List,{className:"ds-resource-combobox__list"},e.createElement(C.Empty,{className:"ds-resource-combobox__empty"},u),a.map(n=>e.createElement(C.Group,{key:n.label,heading:n.label,className:"ds-resource-combobox__group"},n.items.map(o=>{var a;return e.createElement(C.Item,{key:o.id,value:`${o.name} ${null!==(a=o.extension_number)&&void 0!==a?a:""} ${n.label} ${o.id}`,className:"ds-resource-combobox__item"+(o.id===r?" ds-resource-combobox__item--selected":""),onSelect:()=>{return e=o.id,n=o.extension_number?`${o.name} (${b} ${o.extension_number})`:o.name,s(e,n),v(!1),void h("");var e,n}},e.createElement("span",{className:"ds-resource-combobox__name"},o.name),o.extension_number&&e.createElement("span",{className:"ds-resource-combobox__ext"},"(",b," ",o.extension_number,")"),e.createElement("span",{className:"ds-resource-combobox__check"},o.id===r?"✓":""))}),c&&n.type&&e.createElement(C.Item,{forceMount:!0,value:`create new ${n.label}`,className:"ds-resource-combobox__create",onSelect:()=>function(e){return S(this,void 0,void 0,function*(){if(!c)return;const n=yield c(e);n&&(s(n.id,n.extension_number?`${n.name} (${b} ${n.extension_number})`:n.name),v(!1),h(""))})}(n.type)},g))),!w&&!_&&i&&e.createElement("div",{className:"ds-resource-combobox__empty"},f))))},P=({label:n,action:o,children:a})=>e.createElement("div",{className:"ds-dial-plan-config-field"},o?e.createElement("div",{className:"ds-dial-plan-config-field__header"},e.createElement("label",{className:"ds-dial-plan-config-field__label"},n),o):e.createElement("label",{className:"ds-dial-plan-config-field__label"},n),a);function D(e,a,t,i){const[d,s]=n([]),[c,p]=n(!0),u=l(()=>JSON.stringify(e),[e]),f=r(()=>Promise.all(e.map(e=>a(e.type,e.options))).then(n=>{s(e.map((e,o)=>{var a,t;return{label:null!==(a=null==i?void 0:i.resourceGroups[e.labelKey])&&void 0!==a?a:e.fallback,type:e.type,items:null!==(t=n[o])&&void 0!==t?t:[]}}))}).catch(()=>{}).finally(()=>p(!1)),[a,i,u]);o(()=>{f()},[f]);const g=r(n=>S(this,void 0,void 0,function*(){var o;if(!t)return;const a=null===(o=e.find(e=>e.type===n))||void 0===o?void 0:o.options,l=yield t(n,a);return l&&(yield f()),l}),[t,f,u]);return{groups:d,loading:c,handleCreateResource:t?g:void 0}}const M=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("circle",{cx:"12",cy:"12",r:"10"}),e.createElement("polyline",{points:"12 6 12 12 16 14"})),H=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})),$=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),e.createElement("circle",{cx:"9",cy:"7",r:"4"}),e.createElement("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),e.createElement("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})),K=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("polyline",{points:"23 7 23 1 17 1"}),e.createElement("line",{x1:"16",y1:"8",x2:"23",y2:"1"}),e.createElement("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})),B=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("circle",{cx:"5.5",cy:"11.5",r:"4.5"}),e.createElement("circle",{cx:"18.5",cy:"11.5",r:"4.5"}),e.createElement("line",{x1:"5.5",y1:"16",x2:"18.5",y2:"16"})),V=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M12 8V4H8"}),e.createElement("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),e.createElement("path",{d:"M2 14h2"}),e.createElement("path",{d:"M20 14h2"}),e.createElement("path",{d:"M15 13v2"}),e.createElement("path",{d:"M9 13v2"})),W=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("rect",{x:"3",y:"3",width:"7",height:"7"}),e.createElement("rect",{x:"14",y:"3",width:"7",height:"7"}),e.createElement("rect",{x:"3",y:"14",width:"7",height:"7"}),e.createElement("rect",{x:"14",y:"14",width:"7",height:"7"})),U=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91"}),e.createElement("line",{x1:"23",y1:"1",x2:"1",y2:"23"})),q=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),e.createElement("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"}),e.createElement("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})),G={type:"schedule",flowType:"schedule",localeKey:"schedule",label:"Schedule",description:"Route calls by schedule",color:"#0ea5e9",exits:[{id:"open",label:"Open",configKey:"open",localeExitKey:"open"},{id:"closed",label:"Closed",configKey:"closed",localeExitKey:"closed"},{id:"holiday",label:"Holiday",configKey:"holiday",localeExitKey:"holiday"}],configPanel:({config:n,onConfigChange:o,listResources:a,onCreateResource:t,onOpenResource:l,locale:r})=>{var i,d,s,c,p,u;const{groups:f,loading:g,handleCreateResource:b}=D([{type:"schedule",labelKey:"schedules",fallback:"Schedules"}],a,t,r),m=null!==(i=n.schedule_id)&&void 0!==i?i:"",v=void 0!==n.holiday;return e.createElement(e.Fragment,null,e.createElement(P,{label:null!==(d=null==r?void 0:r.configLabels.schedule)&&void 0!==d?d:"Schedule"},e.createElement(I,{groups:f,value:m,loading:g,placeholder:null!==(s=null==r?void 0:r.configLabels.searchSchedules)&&void 0!==s?s:"Search schedules…",onSelect:(e,n)=>o({schedule_id:e},{scheduleName:n}),onCreateResource:b,selectLabel:null==r?void 0:r.combobox.select,noResultsLabel:null==r?void 0:r.combobox.noResults,loadingLabel:null==r?void 0:r.combobox.loading,createNewPrefix:null==r?void 0:r.combobox.createNew,extensionLabel:null==r?void 0:r.combobox.extensionLabel}),m&&l&&e.createElement(F,{resourceId:m,onOpenResource:l,label:null!==(c=null==r?void 0:r.configLabels.openInNewTab)&&void 0!==c?c:"Open target details"})),e.createElement("div",{className:"ds-dial-plan-config-field"},e.createElement("label",{className:"ds-dial-plan-config-field__checkbox"},e.createElement("input",{type:"checkbox",checked:v,onChange:e=>{return n=e.target.checked,o({holiday:n?null:void 0},{holidayEnabled:n});var n}}),e.createElement("span",null,null!==(p=null==r?void 0:r.configLabels.routeHolidaySeparately)&&void 0!==p?p:"Route holidays separately")),e.createElement("p",{className:"ds-dial-plan-config-field__hint"},null!==(u=null==r?void 0:r.configLabels.routeHolidaySeparatelyHint)&&void 0!==u?u:"When on, holidays route to a dedicated branch you wire below. Otherwise holidays follow the Closed exit.")))},defaultConfig:{schedule_id:""},icon:M,renderNode:(n,o)=>{const a=n.locale,t=o.exits.slice(0,n.holidayEnabled?3:2);return e.createElement(e.Fragment,null,e.createElement(T,{icon:o.icon,label:n.label,subtitle:n.scheduleName}),e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(A,{exits:t,locale:a})))},toFlowNode:e=>{const n=e;return{label:"Schedule",scheduleId:n.config.schedule_id,holidayEnabled:void 0!==n.config.holiday,originalNode:n}},collectResourceIds:(e,n)=>{e.schedule_id&&n.addSchedule(e.schedule_id)},enrichNode:(e,n,o)=>{const a=n.schedules.get(e.scheduleId);return Object.assign(Object.assign({},e),{scheduleName:null==a?void 0:a.name,locale:o})},onConfigChange:(e,n,o)=>{"holiday"in n&&void 0===n.holiday&&(o.setEdges(n=>{const a=n.filter(n=>!(n.source===e&&"holiday"===n.sourceHandle));return a.length!==n.length&&o.updateDirty(o.nodesRef.current,a),a}),requestAnimationFrame(()=>o.updateNodeInternals(e)))},serializeConfig:(e,n,o)=>{var a;return(null===(a=e.data)||void 0===a?void 0:a.holidayEnabled)&&void 0===o.holiday?Object.assign(Object.assign({},o),{holiday:null}):o}},Y=({value:n,min:o,max:a,onChange:t,locale:l})=>{var r;return e.createElement(P,{label:null!==(r=null==l?void 0:l.configLabels.timeout)&&void 0!==r?r:"Timeout (seconds)"},e.createElement("input",{className:"ds-dial-plan-config-field__input",type:"number",min:o,max:a,value:n,onChange:e=>t(Math.min(a,Math.max(o,Number(e.target.value)||o)))}))},X={type:"ring_all_users",flowType:"ringAllUsers",localeKey:"ringAllUsers",label:"Ring All",description:"Ring all account users",color:"#f59e0b",exits:[{id:"next",label:"Timeout",configKey:"next",localeExitKey:"timeout"}],configPanel:({config:n,onConfigChange:o,locale:a})=>{var t;const l=null!==(t=n.timeout)&&void 0!==t?t:24;return e.createElement(Y,{value:l,min:1,max:300,onChange:e=>o({timeout:e}),locale:a})},defaultConfig:{timeout:24},icon:$,renderNode:(n,o)=>e.createElement(e.Fragment,null,e.createElement(T,{icon:o.icon,label:n.label,timeout:n.timeout}),o.exits.length>0&&e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(A,{exits:o.exits,locale:n.locale}))),toFlowNode:e=>{const n=e;return{label:"Ring All",timeout:n.config.timeout,originalNode:n}}};function Z(e,n){return e.startsWith("user_")?n.targetTypes.user:e.startsWith("rg_")?n.targetTypes.ringGroup:e.startsWith("dp_")?n.targetTypes.dialPlan:e.startsWith("qu_")?n.targetTypes.queue:e.startsWith("va_")?n.targetTypes.voiceApp:e.startsWith("svm_")?n.targetTypes.sharedVoicemail:n.nodeTypes.internalDial}function Q(e,n,o){const a=n.users.get(e),t=(null==a?void 0:a.name)||(null==a?void 0:a.email);return t&&(null==a?void 0:a.extension_number)?`${t} (${o.combobox.extensionLabel} ${a.extension_number})`:t}const J={type:"internal_dial",flowType:"internalDial",localeKey:"internalDial",label:"Internal Extension",description:"Ring a user, group, or plan",color:"#22c55e",exits:[{id:"next",label:"Timeout",configKey:"next",localeExitKey:"timeout"}],configPanel:({config:n,onConfigChange:o,listResources:a,onCreateResource:t,onOpenResource:l,locale:r})=>{var i,d,s,c,p;const{groups:u,loading:f,handleCreateResource:g}=D([{type:"user",labelKey:"users",fallback:"Users"},{type:"ring_group",labelKey:"ringGroups",fallback:"Ring Groups"},{type:"queue",labelKey:"queues",fallback:"Queues"},{type:"dial_plan",labelKey:"dialPlans",fallback:"Dial Plans"}],a,t,r),b=null!==(i=n.target_id)&&void 0!==i?i:"",m=null!==(d=n.timeout)&&void 0!==d?d:30;return e.createElement(e.Fragment,null,e.createElement(Y,{value:m,min:0,max:300,onChange:e=>o({timeout:e}),locale:r}),e.createElement(P,{label:null!==(s=null==r?void 0:r.configLabels.target)&&void 0!==s?s:"Target"},e.createElement(I,{groups:u,value:b,loading:f,placeholder:null!==(c=null==r?void 0:r.configLabels.searchTargets)&&void 0!==c?c:"Search targets…",onSelect:(e,n)=>o({target_id:e},{targetName:n}),onCreateResource:g,selectLabel:null==r?void 0:r.combobox.select,noResultsLabel:null==r?void 0:r.combobox.noResults,loadingLabel:null==r?void 0:r.combobox.loading,createNewPrefix:null==r?void 0:r.combobox.createNew,extensionLabel:null==r?void 0:r.combobox.extensionLabel}),b&&l&&e.createElement(F,{resourceId:b,onOpenResource:l,label:null!==(p=null==r?void 0:r.configLabels.openInNewTab)&&void 0!==p?p:"Open target details"})))},defaultConfig:{target_id:"",timeout:30},icon:H,renderNode:(n,o)=>e.createElement(e.Fragment,null,e.createElement(T,{icon:o.icon,label:n.label,timeout:n.timeout,subtitle:n.targetName}),e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(A,{exits:o.exits,locale:n.locale}))),toFlowNode:e=>{const n=e;return{label:"Internal Extension",targetId:n.config.target_id,timeout:n.config.timeout,originalNode:n}},collectResourceIds:(e,n)=>{e.target_id&&n.addTarget(e.target_id)},enrichNode:(e,n,o)=>{const a=e.targetId,t=Q(a,n,o),l=Z(a,o);return Object.assign(Object.assign({},e),{targetName:t,targetType:l,locale:o})}};function ee(e){if(!e)return"";const n=L(e);if(!n)return e;return"US"===n.country||"1"===n.countryCallingCode?n.formatNational():n.formatInternational()}const ne={type:"external_dial",flowType:"externalDial",localeKey:"externalDial",label:"External Number",description:"Ring an external phone number",color:"#f43f5e",exits:[{id:"next",label:"Timeout",configKey:"next",localeExitKey:"timeout"}],configPanel:({config:o,onConfigChange:a})=>{var t,l;const i=null!==(t=o.phone_number)&&void 0!==t?t:"",d=null!==(l=o.timeout)&&void 0!==l?l:60,[s,c]=n(ee(i)),p=r(e=>{const n=e.target.value,o=n.startsWith("+")?"+"+n.slice(1).replace(/\D/g,""):n.replace(/\D/g,""),t=o?new z("US").input(o):"";c(t);const l=o?L(o,"US"):null;(null==l?void 0:l.isValid())?a({phone_number:l.number}):o||a({phone_number:""})},[a]),u=r(()=>{const e=L(s,"US");if(null==e?void 0:e.isValid()){const n="US"===e.country||"1"===e.countryCallingCode;c(n?e.formatNational():e.formatInternational()),a({phone_number:e.number})}else a({phone_number:""})},[s,a]),f=r(()=>{c(""),a({phone_number:""})},[a]);return e.createElement(e.Fragment,null,e.createElement(Y,{value:d,min:1,max:120,onChange:e=>a({timeout:e})}),e.createElement(P,{label:"Phone Number"},e.createElement("div",{className:"ds-dial-plan-config-field__input-wrapper"},e.createElement("input",{className:"ds-dial-plan-config-field__input",type:"tel",placeholder:"+1 415 555 1234",value:s,onChange:p,onBlur:u}),s&&e.createElement("button",{type:"button",className:"ds-dial-plan-config-field__clear",onClick:f,"aria-label":"Clear phone number"},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none"},e.createElement("path",{d:"M10.5 3.5L3.5 10.5M3.5 3.5l7 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}))))))},defaultConfig:{phone_number:"",timeout:60},icon:K,renderNode:(n,o)=>e.createElement(e.Fragment,null,e.createElement(T,{icon:o.icon,label:n.label,timeout:n.timeout,subtitle:n.phoneNumber}),e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(A,{exits:o.exits,locale:n.locale}))),toFlowNode:e=>{const n=e;return{label:"External Number",phoneNumber:ee(n.config.phone_number),timeout:n.config.timeout,originalNode:n}}};function oe({label:n,value:o,options:a,onChange:t,hint:l}){return e.createElement(P,{label:n},e.createElement("div",{className:"ds-dial-plan-config-field__segmented",role:"radiogroup","aria-label":n},a.map(n=>{const a=n.value===o;return e.createElement("button",{key:n.value,type:"button",role:"radio","aria-checked":a,className:"ds-dial-plan-config-field__segmented-option"+(a?" ds-dial-plan-config-field__segmented-option--active":""),onClick:()=>{a||t(n.value)}},n.label)})),l&&e.createElement("p",{className:"ds-dial-plan-config-field__hint"},l))}const ae={type:"voice_app",flowType:"voiceApp",localeKey:"voiceApp",label:"Voice App",description:"Route to a voice application",color:"#6366f1",exits:[{id:"next",label:"Timeout",configKey:"next",localeExitKey:"timeout"}],configPanel:({config:n,onConfigChange:a,listResources:t,onCreateResource:l,onOpenResource:r,locale:i})=>{var d,s,c,p,u,f,g,b,m,v;const _=null!==(d=n.voice_app_id)&&void 0!==d?d:"",h=null!==(s=n.mode)&&void 0!==s?s:"control",{groups:x,handleCreateResource:y}=D([{type:"voice_app",labelKey:"voiceApps",fallback:"Voice Apps",options:{notifyEligible:"notify"===h}}],t,l,i);return o(()=>{var e,n;if("notify"!==h||!_)return;const o=null!==(n=null===(e=x[0])||void 0===e?void 0:e.items)&&void 0!==n?n:[];if(0===o.length)return;o.some(e=>e.id===_)||a({voice_app_id:""},{voiceAppName:void 0})},[h,_,x,a]),e.createElement(e.Fragment,null,e.createElement(P,{label:null!==(c=null==i?void 0:i.configLabels.target)&&void 0!==c?c:"Target"},e.createElement(I,{groups:x,value:_,placeholder:null!==(p=null==i?void 0:i.configLabels.searchTargets)&&void 0!==p?p:"Search targets…",onSelect:(e,n)=>a({voice_app_id:e},{voiceAppName:n}),onCreateResource:y,selectLabel:null==i?void 0:i.combobox.select,noResultsLabel:null==i?void 0:i.combobox.noResults,loadingLabel:null==i?void 0:i.combobox.loading,createNewPrefix:null==i?void 0:i.combobox.createNew,extensionLabel:null==i?void 0:i.combobox.extensionLabel}),_&&r&&e.createElement(F,{resourceId:_,onOpenResource:r,label:null!==(u=null==i?void 0:i.configLabels.openInNewTab)&&void 0!==u?u:"Open target details"})),e.createElement(oe,{label:null!==(f=null==i?void 0:i.configLabels.mode)&&void 0!==f?f:"Mode",value:h,options:[{value:"control",label:null!==(g=null==i?void 0:i.voiceAppMode.control)&&void 0!==g?g:"Control"},{value:"notify",label:null!==(b=null==i?void 0:i.voiceAppMode.notify)&&void 0!==b?b:"Notify"}],onChange:e=>a({mode:e}),hint:"notify"===h?null!==(m=null==i?void 0:i.voiceAppMode.notifyHint)&&void 0!==m?m:"Notifies the voice app of the call in the background. The dial plan keeps routing via Next without waiting.":null!==(v=null==i?void 0:i.voiceAppMode.controlHint)&&void 0!==v?v:"Hands the call off to the voice app, which takes over the conversation."}))},defaultConfig:{voice_app_id:"",mode:"control"},icon:V,renderNode:(n,o)=>{var a,t,l,r;const i=n.locale,d="notify"===n.mode,s=d?null!==(a=null==i?void 0:i.voiceAppMode.notifyBadge)&&void 0!==a?a:"Notify mode":null!==(t=null==i?void 0:i.voiceAppMode.controlBadge)&&void 0!==t?t:"Control mode",c=d?null!==(l=null==i?void 0:i.exits.next)&&void 0!==l?l:"Next":null!==(r=null==i?void 0:i.exits.timeout)&&void 0!==r?r:"Timeout";return e.createElement(e.Fragment,null,e.createElement(T,{icon:o.icon,label:n.label,subtitle:n.voiceAppName}),e.createElement("span",{className:"ds-dial-plan-node__badge"},s),e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(j,{id:"next",label:c})))},toFlowNode:e=>{var n;const o=e;return{label:"Voice App",voiceAppId:o.config.voice_app_id,mode:null!==(n=o.config.mode)&&void 0!==n?n:"control",originalNode:o}},normalizeFromAlias:e=>{var n;const o=e.config,a=null!==(n=o.target_id)&&void 0!==n?n:"",t=o.next;return Object.assign(Object.assign({},e),{type:"voice_app",config:Object.assign({voice_app_id:a,mode:"control"},void 0!==t?{next:t}:{})})},collectResourceIds:(e,n)=>{e.voice_app_id&&n.addTarget(e.voice_app_id)},enrichNode:(e,n,o)=>{const a=e.voiceAppId,t=a?Q(a,n,o):void 0;return Object.assign(Object.assign({},e),{voiceAppName:t,locale:o})}},te={type:"voicemail",apiType:"internal_dial",flowType:"voicemail",localeKey:"voicemail",label:"Voicemail",description:"Send to voicemail",color:"#8b5cf6",exits:[],configPanel:({config:n,onConfigChange:o,listResources:a,onCreateResource:t,onOpenResource:l,locale:r})=>{var i,d,s,c;const{groups:p,loading:u,handleCreateResource:f}=D([{type:"user",labelKey:"users",fallback:"Users"},{type:"shared_voicemail",labelKey:"sharedVoicemails",fallback:"Shared Voicemails"}],a,t,r),g=null!==(i=n.target_id)&&void 0!==i?i:"";return e.createElement(P,{label:null!==(d=null==r?void 0:r.configLabels.target)&&void 0!==d?d:"Target"},e.createElement(I,{groups:p,value:g,loading:u,placeholder:null!==(s=null==r?void 0:r.configLabels.searchTargets)&&void 0!==s?s:"Search targets…",onSelect:(e,n)=>o({target_id:e,timeout:0},{targetName:n}),onCreateResource:f,selectLabel:null==r?void 0:r.combobox.select,noResultsLabel:null==r?void 0:r.combobox.noResults,loadingLabel:null==r?void 0:r.combobox.loading,createNewPrefix:null==r?void 0:r.combobox.createNew,extensionLabel:null==r?void 0:r.combobox.extensionLabel}),g&&l&&e.createElement(F,{resourceId:g,onOpenResource:l,label:null!==(c=null==r?void 0:r.configLabels.openInNewTab)&&void 0!==c?c:"Open target details"}))},defaultConfig:{target_id:"",timeout:0},icon:B,renderNode:(n,o)=>e.createElement(T,{icon:o.icon,label:n.label,subtitle:n.targetName}),toFlowNode:e=>{const n=e;return{label:"Voicemail",targetId:n.config.target_id,timeout:0,originalNode:n}},collectResourceIds:(e,n)=>{e.target_id&&n.addTarget(e.target_id)},enrichNode:(e,n,o)=>{const a=e.targetId,t=Q(a,n,o),l=Z(a,o);return Object.assign(Object.assign({},e),{targetName:t,targetType:l,locale:o})}},le=["1","2","3","4","5","6","7","8","9","0","*","#"];function re(e){return"*"===e?"digit_star":"#"===e?"digit_hash":`digit_${e}`}const ie=[{id:"timeout",label:"Timeout",configKey:"timeout_next_node",localeExitKey:"timeout"},{id:"invalid",label:"Invalid",configKey:"invalid_next_node",localeExitKey:"invalid"}],de={type:"menu",flowType:"menu",localeKey:"menu",label:"IVR Menu",description:"Play prompt and route by keypress",color:"#ec4899",exits:[...ie],allowSelfLoop:!0,configPanel:({config:n,onConfigChange:o,listResources:a,onCreateResource:t,locale:l})=>{var r,i,d,s,c,p,u;const{groups:f,loading:g,handleCreateResource:b}=D([{type:"audio_clip",labelKey:"audioClips",fallback:"Audio Clips"}],a,t,l),m=null!==(r=n.prompt_clip_id)&&void 0!==r?r:"",v=null!==(i=n.timeout)&&void 0!==i?i:5,_=null!==(d=n.options)&&void 0!==d?d:[{digit:"1"}],h=new Set(_.map(e=>e.digit));return e.createElement(e.Fragment,null,e.createElement(P,{label:null!==(s=null==l?void 0:l.configLabels.promptClip)&&void 0!==s?s:"Prompt"},e.createElement(I,{groups:f,value:m,loading:g,placeholder:null!==(c=null==l?void 0:l.configLabels.search)&&void 0!==c?c:"Search...",onSelect:(e,n)=>o({prompt_clip_id:e},{promptClipName:n}),onCreateResource:b,selectLabel:null==l?void 0:l.combobox.select,noResultsLabel:null==l?void 0:l.combobox.noResults,loadingLabel:null==l?void 0:l.combobox.loading,createNewPrefix:null==l?void 0:l.combobox.createNew})),e.createElement(Y,{value:v,min:1,max:30,onChange:e=>o({timeout:e}),locale:l}),e.createElement(P,{label:null!==(p=null==l?void 0:l.configLabels.options)&&void 0!==p?p:"Options",action:e.createElement("button",{type:"button",className:"ds-dial-plan-menu-options__add",onClick:function(){const e=le.find(e=>!h.has(e));e&&o({options:[..._,{digit:e}]})},disabled:_.length>=12},"+ ",null!==(u=null==l?void 0:l.configLabels.addOption)&&void 0!==u?u:"Add")},e.createElement("div",{className:"ds-dial-plan-menu-options"},_.map((n,a)=>{var t,r,i,d,s,c;return e.createElement("div",{key:a,className:"ds-dial-plan-menu-options__card"},e.createElement("div",{className:"ds-dial-plan-menu-options__field ds-dial-plan-menu-options__field--label"},e.createElement("span",{className:"ds-dial-plan-menu-options__field-label"},null!==(t=null==l?void 0:l.configLabels.optionLabel)&&void 0!==t?t:"Label"," ",e.createElement("span",{className:"ds-dial-plan-menu-options__field-hint"},"(optional)")),e.createElement("input",{type:"text",className:"ds-dial-plan-config-field__input",value:null!==(r=n.label)&&void 0!==r?r:"",maxLength:20,placeholder:null!==(i=null==l?void 0:l.configLabels.optionLabelPlaceholder)&&void 0!==i?i:"e.g. Sales",onChange:e=>{return n=a,t=e.target.value,void o({options:_.map((e,o)=>{if(o!==n)return e;const a=Object.assign({},e);return t?a.label=t:delete a.label,a})});var n,t}})),e.createElement("div",{className:"ds-dial-plan-menu-options__field ds-dial-plan-menu-options__field--digit"},e.createElement("span",{className:"ds-dial-plan-menu-options__field-label"},null!==(d=null==l?void 0:l.configLabels.digit)&&void 0!==d?d:"Digit"),e.createElement("select",{className:"ds-dial-plan-config-field__input",value:n.digit,onChange:e=>{return n=a,t=e.target.value,void o({options:_.map((e,o)=>o===n?Object.assign(Object.assign({},e),{digit:t}):e)});var n,t}},le.filter(e=>e===n.digit||!h.has(e)).map(n=>e.createElement("option",{key:n,value:n},"*"===n?"✱":n)))),e.createElement("button",{type:"button",className:"ds-dial-plan-menu-options__remove",onClick:()=>{return e=a,void o({options:_.filter((n,o)=>o!==e)});var e},title:null!==(s=null==l?void 0:l.configLabels.removeOption)&&void 0!==s?s:"Remove","aria-label":null!==(c=null==l?void 0:l.configLabels.removeOption)&&void 0!==c?c:"Remove"},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))))}))))},defaultConfig:{prompt_clip_id:"",timeout:5,options:[{digit:"1"}]},icon:W,renderNode:(n,o)=>{var a;const t=null!==(a=n.options)&&void 0!==a?a:[],l=n.locale;return e.createElement(e.Fragment,null,e.createElement(T,{icon:o.icon,label:n.label,timeout:n.timeout,subtitle:n.promptClipName}),e.createElement("div",{className:"ds-dial-plan-node__exits"},t.map(n=>{const o="*"===n.digit?"✱":n.digit,a=n.label?`${n.label} — ${o}`:o;return e.createElement(j,{key:n.digit,id:re(n.digit),label:a})}),e.createElement(A,{exits:o.exits,locale:l})))},toFlowNode:e=>{const n=e;return{label:"IVR Menu",promptClipId:n.config.prompt_clip_id,timeout:n.config.timeout,options:n.config.options,originalNode:n}},createEdgesForNode:(e,n)=>{const o=e,a=[];o.config.timeout_next_node&&n.has(o.config.timeout_next_node)&&a.push({id:`${o.id}-timeout->${o.config.timeout_next_node}`,source:o.id,target:o.config.timeout_next_node,sourceHandle:"timeout",type:R}),o.config.invalid_next_node&&n.has(o.config.invalid_next_node)&&a.push({id:`${o.id}-invalid->${o.config.invalid_next_node}`,source:o.id,target:o.config.invalid_next_node,sourceHandle:"invalid",type:R});for(const e of o.config.options)if(e.next_node&&n.has(e.next_node)){const n=re(e.digit);a.push({id:`${o.id}-${n}->${e.next_node}`,source:o.id,target:e.next_node,sourceHandle:n,type:R})}return a},collectResourceIds:(e,n)=>{e.prompt_clip_id&&n.addAudioClip(e.prompt_clip_id)},enrichNode:(e,n,o)=>{const a=n.audioClips.get(e.promptClipId);return Object.assign(Object.assign({},e),{promptClipName:null==a?void 0:a.name,locale:o})},resolveExitLabel:e=>{const n=function(e){if("digit_star"===e)return"*";if("digit_hash"===e)return"#";const n=e.match(/^digit_(\d)$/);return null==n?void 0:n[1]}(e);if(n)return"*"===n?"✱":n},onConfigChange:(e,n,o)=>{var a,t;if(!n.options)return;const l=n.options,r=new Set(l.map(e=>re(e.digit)));for(const e of ie)r.add(e.id);const i=o.nodesRef.current.find(n=>n.id===e),d=null!==(t=null===(a=null==i?void 0:i.data)||void 0===a?void 0:a.options)&&void 0!==t?t:[],s=new Map;if(d.length===l.length)for(let e=0;e<l.length;e++){const n=re(d[e].digit),o=re(l[e].digit);n!==o&&s.set(n,o)}o.setEdges(n=>{const a=n.map(n=>{if(n.source!==e||!n.sourceHandle)return n;const o=s.get(n.sourceHandle);return o?Object.assign(Object.assign({},n),{sourceHandle:o,id:`${e}-${o}->${n.target}`}):n}).filter(n=>n.source!==e||!n.sourceHandle||r.has(n.sourceHandle));return(a.length!==n.length||s.size>0)&&o.updateDirty(o.nodesRef.current,a),a}),requestAnimationFrame(()=>o.updateNodeInternals(e))},serializeConfig:(e,n,o)=>{var a;const t=(null!==(a=o.options)&&void 0!==a?a:[]).map(o=>{const a=re(o.digit),t=n.find(n=>n.source===e.id&&n.sourceHandle===a),l={digit:o.digit};return o.label&&(l.label=o.label),t&&(l.next_node=t.target),l});return Object.assign(Object.assign({},o),{options:t})}},se={type:"audio_clip",flowType:"audioClip",localeKey:"audioClip",label:"Audio Clip",description:"Play an audio clip",color:"#14b8a6",exits:[{id:"next",label:"Next",configKey:"next",localeExitKey:"next"}],configPanel:({config:n,onConfigChange:o,listResources:a,onCreateResource:t,locale:l})=>{var r,i,d;const{groups:s,loading:c,handleCreateResource:p}=D([{type:"audio_clip",labelKey:"audioClips",fallback:"Audio Clips"}],a,t,l),u=null!==(r=n.clip_id)&&void 0!==r?r:"";return e.createElement(P,{label:null!==(i=null==l?void 0:l.configLabels.audioClip)&&void 0!==i?i:"Audio Clip"},e.createElement(I,{groups:s,value:u,loading:c,placeholder:null!==(d=null==l?void 0:l.configLabels.search)&&void 0!==d?d:"Search...",onSelect:(e,n)=>o({clip_id:e},{clipName:n}),onCreateResource:p,selectLabel:null==l?void 0:l.combobox.select,noResultsLabel:null==l?void 0:l.combobox.noResults,loadingLabel:null==l?void 0:l.combobox.loading,createNewPrefix:null==l?void 0:l.combobox.createNew}))},defaultConfig:{clip_id:""},icon:q,renderNode:(n,o)=>e.createElement(e.Fragment,null,e.createElement(T,{icon:o.icon,label:n.label,subtitle:n.clipName}),e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(A,{exits:o.exits,locale:n.locale}))),toFlowNode:e=>{const n=e;return{label:"Audio Clip",clipId:n.config.clip_id,originalNode:n}},normalizeFromAlias:e=>Object.assign(Object.assign({},e),{type:"audio_clip"}),collectResourceIds:(e,n)=>{e.clip_id&&n.addAudioClip(e.clip_id)},enrichNode:(e,n,o)=>{const a=n.audioClips.get(e.clipId);return Object.assign(Object.assign({},e),{clipName:null==a?void 0:a.name,locale:o})}},ce={type:"hang_up",flowType:"hangUp",localeKey:"hangUp",label:"Hang Up",description:"End the call",color:"#ef4444",exits:[],configPanel:({locale:n})=>{var o;return e.createElement("div",{className:"ds-dial-plan-config-panel__note"},null!==(o=null==n?void 0:n.nodeDescriptions.hangUp)&&void 0!==o?o:"End the call")},defaultConfig:{},icon:U,renderNode:(n,o)=>e.createElement(T,{icon:o.icon,label:n.label}),toFlowNode:e=>({label:"Hang Up",originalNode:e}),enrichNode:(e,n,o)=>Object.assign(Object.assign({},e),{label:o.nodeTypes.hangUp,locale:o})},pe=new class{constructor(){this.byType=new Map,this.byFlowType=new Map,this.legacyTypeAliases=new Map}register(e){this.byType.set(e.type,e),this.byFlowType.set(e.flowType,e)}registerAlias(e,n){this.legacyTypeAliases.set(e,n)}get(e){return this.byType.get(e)}resolveType(e){var n;let o=this.byType.get(e.type);if(!o){const n=this.legacyTypeAliases.get(e.type);n&&(o=this.byType.get(n))}return(null==o?void 0:o.resolveAlias)&&null!==(n=o.resolveAlias(e))&&void 0!==n?n:o}getByFlowType(e){return this.byFlowType.get(e)}getAll(){return Array.from(this.byType.values())}getNodeTypesMap(){const e={};for(const n of this.byType.values())e[n.flowType]=n.component;return e}createEdgesForNode(e,n){const o=this.resolveType(e);if(!o)return[];if(o.createEdgesForNode)return o.createEdgesForNode(e,n);const a=[];for(const t of o.exits){const o=e.config[t.configKey];o&&n.has(o)&&a.push({id:`${e.id}-${t.id}->${o}`,source:e.id,target:o,sourceHandle:t.id,type:R})}return a}},ue=(fe=pe,a(function({data:n,selected:o,type:a}){const t=fe.getByFlowType(null!=a?a:"");if(!t)return null;const l=t.renderNode(n,t),r=t.type.replace(/_/g,"-");return e.createElement("div",{className:`ds-dial-plan-node ds-dial-plan-node--themed ds-dial-plan-node--${r} ${o?"ds-dial-plan-node--selected":""}`,style:{"--node-color":t.color}},e.createElement(d,{type:"target",position:s.Left,className:"ds-dial-plan-handle"}),l)}));var fe;const ge=[G,X,J,ne,ae,te,de,se,ce];for(const e of ge)pe.register(Object.assign(Object.assign({},e),{component:ue}));const be=pe.get("internal_dial");be&&(be.resolveAlias=e=>{const n=e.config,o=n.target_id;return(null==o?void 0:o.startsWith("svm_"))||0===n.timeout&&!n.next?pe.get("voicemail"):(null==o?void 0:o.startsWith("va_"))?pe.get("voice_app"):void 0}),pe.registerAlias("sound_clip","audio_clip");const me="__start__";function ve(e,n=pe){var o;const a=[],t=[],l=new Map;for(const n of e.nodes)l.set(n.id,n);const r={id:me,type:"start",position:{x:0,y:0},data:{label:"Start"}};a.push(r),e.entry_node&&l.has(e.entry_node)&&t.push({id:`${me}->${e.entry_node}`,source:me,target:e.entry_node,type:R});for(const r of e.nodes){const e=n.resolveType(r),i=null!==(o=r.position)&&void 0!==o?o:{x:0,y:0},d=e&&e.type!==r.type&&e.normalizeFromAlias?e.normalizeFromAlias(r):r;if(e){const n=e.toFlowNode(d),o={id:r.id,type:e.flowType,position:i,data:n};a.push(o)}else a.push({id:r.id,type:"default",position:i,data:{label:r.id,originalNode:r}});const s=n.createEdgesForNode(d,l);t.push(...s)}return e.nodes.some(e=>!e.position)?xe(a,t):{nodes:a,edges:t}}function _e(e,n,o){var a,t,l,r;const i=n.find(e=>e.source===me),d=null!==(a=null==i?void 0:i.target)&&void 0!==a?a:"",s=[];for(const a of e){if(a.id===me)continue;const e=o.getByFlowType(null!==(t=a.type)&&void 0!==t?t:"");if(!e||!(null===(l=a.data)||void 0===l?void 0:l.originalNode))continue;const i=a.data.originalNode,d=Object.assign({},i.config);for(const n of e.exits)d[n.configKey]=void 0;for(const o of n){if(o.source!==a.id)continue;const n=e.exits.find(e=>e.id===o.sourceHandle);n&&(d[n.configKey]=o.target)}const c=e.serializeConfig?e.serializeConfig(a,n,d):d;s.push({id:a.id,type:null!==(r=e.apiType)&&void 0!==r?r:i.type,position:a.position,config:c})}return{entry_node:d,nodes:s}}function he(e){var n,o,a;if((null===(n=e.measured)||void 0===n?void 0:n.width)&&(null===(o=e.measured)||void 0===o?void 0:o.height))return{width:e.measured.width,height:e.measured.height};if("start"===e.type)return{width:60,height:60};if("schedule"===e.type)return{width:180,height:140};if("menu"===e.type){const n=e.data.options;return{width:180,height:60+28*((null!==(a=null==n?void 0:n.length)&&void 0!==a?a:1)+2)}}return{width:180,height:80}}function xe(e,n){var o;const a=new N.graphlib.Graph;a.setGraph({rankdir:"LR",nodesep:60,ranksep:80,marginx:40,marginy:40}),a.setDefaultEdgeLabel(()=>({}));for(const n of e){const{width:e,height:o}=he(n);a.setNode(n.id,{width:e,height:o})}for(const e of n)a.setEdge(e.source,e.target);N.layout(a);const t=new Map;for(const n of e){const e=a.node(n.id),{width:o,height:l}=he(n);t.set(n.id,{x:Math.round(e.x-o/2),y:Math.round(e.y-l/2)})}const l=new Map;for(const e of n){const n=l.get(e.source);n?n.push(e.target):l.set(e.source,[e.target])}const r=e=>{var n;const o=new Set([e]),a=[e];for(;a.length>0;){const e=a.shift();for(const t of null!==(n=l.get(e))&&void 0!==n?n:[])o.has(t)||(o.add(t),a.push(t))}return o};for(const a of e){const e=pe.getByFlowType(null!==(o=a.type)&&void 0!==o?o:"");if(!e||e.exits.length<2)continue;const l=[];for(const o of e.exits){const e=n.find(e=>e.source===a.id&&e.sourceHandle===o.id);e&&l.push(e.target)}if(l.length<2)continue;const i=l[0],d=l[1],s=t.get(i),c=t.get(d);if(!s||!c)continue;if(s.y<=c.y)continue;const p=r(i),u=r(d);if([...p].some(e=>u.has(e)))continue;const f=s.y-c.y;for(const e of p){const n=t.get(e);n&&(n.y-=f)}for(const e of u){const n=t.get(e);n&&(n.y+=f)}}const i=e.find(e=>e.id===me),d=t.get(me),s=i&&d?i.position.x-d.x:0,c=i&&d?i.position.y-d.y:0;return{nodes:e.map(e=>{const n=t.get(e.id);return Object.assign(Object.assign({},e),{position:{x:n.x+s,y:n.y+c}})}),edges:n}}const ye=a(function({data:n}){return e.createElement("div",{className:"ds-dial-plan-node ds-dial-plan-node--start"},e.createElement("div",{className:"ds-dial-plan-node__content"},e.createElement("span",{className:"ds-dial-plan-node__label"},n.label)),e.createElement(d,{type:"source",position:s.Right,className:"ds-dial-plan-handle"}))}),we=({registry:n,onAddNode:o,locale:a})=>{const t=n.getAll();return e.createElement("div",{className:"ds-dial-plan-node-library"},t.map(n=>{var t,l;const r=null!==(t=null==a?void 0:a.nodeTypes[n.localeKey])&&void 0!==t?t:n.label,i=null!==(l=null==a?void 0:a.nodeDescriptions[n.localeKey])&&void 0!==l?l:n.description;return e.createElement("div",{key:n.type,className:`ds-dial-plan-node-library__item ds-dial-plan-node-library__item--${n.type}`,style:{"--node-color":n.color},draggable:!0,onClick:()=>o(n.type),onDragStart:e=>{const o=e.currentTarget.getBoundingClientRect(),a=(e.clientX-o.left)/o.width,t=(e.clientY-o.top)/o.height;e.dataTransfer.setData("application/reactflow",n.type),e.dataTransfer.setData("application/reactflow-grab-frac",`${a},${t}`),e.dataTransfer.effectAllowed="move"},title:i},e.createElement("span",{className:"ds-dial-plan-node-library__item-icon"},n.icon),e.createElement("span",{className:"ds-dial-plan-node-library__item-label"},r))}))},ke=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("polyline",{points:"3 6 5 6 21 6"}),e.createElement("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})),Ee=({node:n,registration:a,onConfigChange:l,onDelete:r,onClose:i,listResources:d,onCreateResource:s,onOpenResource:c,locale:p})=>{var u,f,g;const b=t(null);o(()=>{var e;const n=null===(e=b.current)||void 0===e?void 0:e.getRootNode(),o=n instanceof ShadowRoot||n instanceof Document?n:document,a=e=>function(e){"Escape"===e.key&&i()}(e);return o.addEventListener("keydown",a),()=>o.removeEventListener("keydown",a)},[i]);const m=n.data.originalNode,v=null!==(u=null==m?void 0:m.config)&&void 0!==u?u:{},_=a.configPanel;return e.createElement("div",{ref:b,className:"ds-dial-plan-config-panel"},e.createElement("div",{className:"ds-dial-plan-config-panel__header"},e.createElement("span",{className:"ds-dial-plan-config-panel__header-icon"},a.icon),e.createElement("span",{className:"ds-dial-plan-config-panel__header-label"},a.label),e.createElement("button",{type:"button",className:"ds-dial-plan-config-panel__delete",onClick:()=>{r(n.id),i()},title:null!==(f=null==p?void 0:p.panel.delete_)&&void 0!==f?f:"Delete"},ke),e.createElement("button",{className:"ds-dial-plan-config-panel__close",onClick:i,title:null!==(g=null==p?void 0:p.panel.close)&&void 0!==g?g:"Close",type:"button"},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})))),e.createElement("div",{className:"ds-dial-plan-config-panel__body"},e.createElement(_,{config:v,onConfigChange:(e,o)=>l(n.id,e,o),listResources:d,onCreateResource:s,onOpenResource:c,locale:p})))},Ne=a(function({onAutoLayout:n,onSave:o,isDirty:a,locale:t}){var l;const r=null!==(l=null==t?void 0:t.toolbar)&&void 0!==l?l:{autoLayout:"Auto Layout",save:"Save"};return e.createElement("div",{className:"ds-dial-plan-editor-toolbar"},e.createElement("button",{className:"ds-dial-plan-editor-toolbar__button",onClick:n,title:r.autoLayout,type:"button"},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},e.createElement("rect",{x:"3",y:"3",width:"7",height:"7"}),e.createElement("rect",{x:"14",y:"3",width:"7",height:"7"}),e.createElement("rect",{x:"14",y:"14",width:"7",height:"7"}),e.createElement("line",{x1:"6.5",y1:"10",x2:"6.5",y2:"17"}),e.createElement("line",{x1:"6.5",y1:"17",x2:"14",y2:"17.5"})),e.createElement("span",null,r.autoLayout)),o&&e.createElement("button",{className:"ds-dial-plan-editor-toolbar__button",onClick:o,title:r.save,type:"button",disabled:!a},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},e.createElement("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),e.createElement("polyline",{points:"17 21 17 13 7 13 7 21"}),e.createElement("polyline",{points:"7 3 7 8 15 8"})),e.createElement("span",null,r.save)))});var Ce;const Le=!("undefined"==typeof window||void 0===window.document||"function"!=typeof HTMLElement.prototype.attachShadow||"undefined"==typeof navigator||/jsdom/i.test(null!==(Ce=navigator.userAgent)&&void 0!==Ce?Ce:"")||"undefined"!=typeof window&&"__STORYBOOK_PREVIEW__"in window),ze=({children:a,stylesheets:l,className:i,style:d})=>{const[s,c]=n(null),p=t(null),u=r(e=>{var n;if(p.current=e,!Le||!e)return;const o=null!==(n=e.shadowRoot)&&void 0!==n?n:e.attachShadow({mode:"open"});c(o)},[]);o(()=>{Le&&p.current&&function(e,n){const o=e.shadowRoot;o&&(o.adoptedStyleSheets=n.map(e=>{const n=new CSSStyleSheet;return n.replaceSync(e),n}))}(p.current,l)},[l]);const f=t(null);return o(()=>{if(!Le&&0!==l.length)return f.current||(f.current=document.createElement("style"),document.head.appendChild(f.current)),f.current.textContent=l.join("\n"),()=>{f.current&&(f.current.remove(),f.current=null)}},[l]),Le?e.createElement("div",{ref:u,className:i,style:d},s&&O(a,s)):e.createElement("div",{className:i,style:d},a)},Oe={nodeTypes:{start:"Start",schedule:"Schedule",internalDial:"Internal Extension",voicemail:"Voicemail",externalDial:"External Number",ringAllUsers:"Ring All Users",voiceApp:"Voice App",menu:"IVR Menu",audioClip:"Audio Clip",hangUp:"Hang Up"},exits:{open:"Open",closed:"Closed",holiday:"Holiday",next:"Next",timeout:"Timeout",invalid:"Invalid"},nodeDescriptions:{schedule:"Route calls by schedule",internalDial:"Ring a user, group, or plan",voicemail:"Send to voicemail",ringAllUsers:"Ring all users",externalDial:"Ring an external phone number",voiceApp:"Route to a voice application",menu:"Play prompt and route by keypress",audioClip:"Play an audio clip",hangUp:"End the call"},targetTypes:{user:"User",ringGroup:"Ring Group",dialPlan:"Dial Plan",queue:"Queue",voiceApp:"Voice App",sharedVoicemail:"Shared Voicemail"},resourceGroups:{users:"Users",ringGroups:"Ring Groups",dialPlans:"Dial Plans",queues:"Queues",voiceApps:"Voice Apps",sharedVoicemails:"Shared Voicemails",schedules:"Schedules",audioClips:"Audio Clips"},configLabels:{timeout:"Timeout (seconds)",target:"Target",schedule:"Schedule",search:"Search...",searchTargets:"Search targets...",searchSchedules:"Search schedules...",openInNewTab:"Open target details",promptClip:"Prompt",audioClip:"Audio Clip",digit:"Digit",options:"Options",addOption:"Add Option",removeOption:"Remove",optionLabel:"Label",optionLabelPlaceholder:"e.g. Sales",routeHolidaySeparately:"Route holidays separately",routeHolidaySeparatelyHint:"When on, holidays route to a dedicated branch you wire below. Otherwise holidays follow the Closed exit.",mode:"Mode"},voiceAppMode:{control:"Control",notify:"Notify",controlBadge:"Control mode",notifyBadge:"Notify mode",controlHint:"Hands the call off to the voice app, which takes over the conversation.",notifyHint:"Notifies the voice app of the call in the background. The dial plan keeps routing via Next without waiting."},toolbar:{autoLayout:"Auto Layout",save:"Save"},panel:{delete_:"Delete",close:"Close",connection:"Connection",from:"From",exit:"Exit",to:"To"},combobox:{select:"— Select —",search:"Search...",noResults:"No results found",loading:"Loading...",createNew:"+ Create new...",extensionLabel:"Ext.",noName:"(No name)"},status:{loading:"Loading dial plan...",loadError:"Failed to load dial plan",notFound:"No dial plan found",saveError:"Failed to save dial plan",newDialPlan:"New Dial Plan"}},Se={schedule_id:"A schedule must be selected in the Schedule node",target_id:"A target must be selected in the Internal Extension node",phone_number:"Enter a valid US phone number in the External Number node"},Re={schedule:"Schedule",internal_dial:"Internal Extension",ring_all_users:"Ring All",external_dial:"External Number"};const Te={view:{editable:!1,interactive:!0,showChrome:!0},edit:{editable:!0,interactive:!0,showChrome:!0},preview:{editable:!1,interactive:!1,showChrome:!1}},je={id:"",name:"New Dial Plan",entry_node:"",nodes:[],created_at:"",updated_at:""},Ae=Object.assign({start:ye},pe.getNodeTypesMap()),Fe={[R]:n=>{const{sourceX:o,sourceY:a,targetX:t,targetY:l,sourcePosition:r,targetPosition:i,markerEnd:d,style:s}=n,f=Math.abs(a-l),[g]=f<=1?c({sourceX:o,sourceY:a,targetX:t,targetY:l}):p({sourceX:o,sourceY:a,targetX:t,targetY:l,sourcePosition:r,targetPosition:i,borderRadius:8});return e.createElement(u,{path:g,markerEnd:d,style:s})}};const Ie=e.forwardRef(function({dialPlanId:a,mode:l="view",locale:d=Oe,onNodeClick:s,onLoaderStart:c,onLoaderEnd:p,onLoadError:u,onSave:f,onDirtyChange:N,onError:C,className:L,style:z,onCreateResource:O,onOpenResource:T},j){var A;const{editable:F,interactive:I,showChrome:P}=Te[l],{dialstack:D}=E(),M=g(),H=b(),[$,K]=n(!F||!!a),[B,V]=n(null),[W,U]=m([]),[q,G,Y]=v([]),[X,Q]=n(null),[J,ee]=n(null),[ne,oe]=n(!1);o(()=>{var e,n;null===(n=(e=de.current).onDirtyChange)||void 0===n||n.call(e,ne)},[ne]);const[ae,te]=n(null),le=t(null),re=t(W),ie=t(q);re.current=W,ie.current=q;const de=t({onLoaderStart:c,onLoaderEnd:p,onLoadError:u,onError:C,onSave:f,onDirtyChange:N});de.current={onLoaderStart:c,onLoaderEnd:p,onLoadError:u,onError:C,onSave:f,onDirtyChange:N};const se=t(null),ce=t(!1);o(()=>{let e=!1;return function(){S(this,void 0,void 0,function*(){var n,o,t,l,r,i,s,c;if(F&&!a){const{nodes:n,edges:o}=ve(Object.assign(Object.assign({},je),{name:d.status.newDialPlan}),pe);return void(e||(U(n),G(o),se.current={nodes:n,edges:o},K(!1)))}K(!0),V(null),null===(o=(n=de.current).onLoaderStart)||void 0===o||o.call(n);try{const n=yield D.dialPlans.retrieve(a);if(e)return;const o=yield function(e,n){return S(this,void 0,void 0,function*(){var o;const a=new Set,t=new Set,l=new Set;for(const n of e.nodes){const e=pe.resolveType(n),r=e?ge.find(n=>{var o;return n.type===(null!==(o=e.apiType)&&void 0!==o?o:e.type)}):null;null===(o=null==r?void 0:r.collectResourceIds)||void 0===o||o.call(r,n.config,{addSchedule:e=>a.add(e),addTarget:e=>t.add(e),addAudioClip:e=>l.add(e)})}const r=l.size>0?n.audioClips.list().catch(()=>[]):Promise.resolve([]),[i,d,...s]=yield Promise.all([Promise.all(Array.from(a).map(e=>S(this,void 0,void 0,function*(){try{return yield n.schedules.retrieve(e)}catch(e){return null}}))),r,...Array.from(t).map(e=>S(this,void 0,void 0,function*(){var o;const a=yield n.resolveRoutingTarget(e);return a?{id:a.id,name:a.name||a.id,extension_number:null!==(o=a.extension_number)&&void 0!==o?o:void 0}:null}))]),c=new Map,p=new Map,u=new Map;for(const e of i)e&&c.set(e.id,e);for(const e of s)e&&p.set(e.id,e);for(const e of d)u.set(e.id,e);return{schedules:c,users:p,audioClips:u}})}(n,D);if(e)return;const{nodes:r,edges:i}=ve(n,pe),s=function(e,n,o){return e.map(e=>{var a;const t=pe.getByFlowType(null!==(a=e.type)&&void 0!==a?a:""),l=t?ge.find(e=>{var n;return e.type===(null!==(n=t.apiType)&&void 0!==n?n:t.type)}):null;return(null==l?void 0:l.enrichNode)?Object.assign(Object.assign({},e),{data:l.enrichNode(e.data,n,o)}):Object.assign(Object.assign({},e),{data:Object.assign(Object.assign({},e.data),{locale:o})})})}(r,o,d);U(s),G(i),se.current={nodes:s,edges:i},te({id:n.id,name:n.name}),K(!1),null===(l=(t=de.current).onLoaderEnd)||void 0===l||l.call(t,n)}catch(n){if(!e){const e=n instanceof Error?n:new Error(String(n));V(e),K(!1),null===(i=(r=de.current).onLoadError)||void 0===i||i.call(r,e),null===(c=(s=de.current).onError)||void 0===c||c.call(s,e)}}})}(),()=>{e=!0}},[D,a,U,G]);const ue=r((e,n)=>{if(!se.current)return;const o=(e,n)=>JSON.stringify({nodes:e.map(e=>({id:e.id,data:e.data,position:e.position})),edges:n.map(e=>({id:e.id,source:e.source,target:e.target,sourceHandle:e.sourceHandle}))}),a=o(se.current.nodes,se.current.edges)!==o(e,n);oe(a)},[]);o(()=>{ce.current&&(ce.current=!1,ue(W,q))},[W,q,ue]);const fe=r(e=>{Y(e),e.some(e=>"remove"===e.type)&&queueMicrotask(()=>ue(re.current,ie.current))},[Y,ue]),be=r(e=>{const n=re.current.filter(n=>n.id!==e).map(n=>{var o;const a=null===(o=n.data)||void 0===o?void 0:o.originalNode;if(!a)return n;const t=a.config;if(!t)return n;const l=Object.assign({},t);let r=!1;for(const n of Object.keys(l))l[n]===e&&(l[n]=void 0,r=!0);return r?Object.assign(Object.assign({},n),{data:Object.assign(Object.assign({},n.data),{originalNode:Object.assign(Object.assign({},a),{config:l})})}):n}),o=ie.current.filter(n=>n.source!==e&&n.target!==e);U(n),G(o),ue(n,o),X===e&&Q(null)},[U,G,X,ue]),me=r(e=>{const n=new Set(e.filter(e=>"remove"===e.type&&"id"in e&&"__start__"!==e.id).map(e=>"id"in e?e.id:""));if(n.size>0){const e=re.current.filter(e=>!n.has(e.id)).map(e=>{var o;const a=null===(o=e.data)||void 0===o?void 0:o.originalNode;if(!a)return e;const t=a.config;if(!t)return e;const l=Object.assign({},t);let r=!1;for(const e of Object.keys(l))"string"==typeof l[e]&&n.has(l[e])&&(l[e]=void 0,r=!0);return r?Object.assign(Object.assign({},e),{data:Object.assign(Object.assign({},e.data),{originalNode:Object.assign(Object.assign({},a),{config:l})})}):e}),o=ie.current.filter(e=>!n.has(e.source)&&!n.has(e.target));U(e),G(o),ue(e,o),X&&n.has(X)&&Q(null)}const o=e.filter(e=>"remove"!==e.type&&!("position"===e.type&&"id"in e&&"__start__"===e.id));0!==o.length&&(o.some(e=>"position"===e.type&&!e.dragging)&&(ce.current=!0),U(e=>_(o,e)))},[U,G,ue,X]),he=r((e,n,o)=>{var a,t;const l=pe.get(e);if(!l)return;const r=`${e}_${crypto.randomUUID().replace(/-/g,"").slice(0,12)}`;let i=n;if(!i){const e=null===(a=le.current)||void 0===a?void 0:a.getBoundingClientRect(),n=e?e.left+e.width/2:400,o=e?e.top+e.height/2:300;i=M.screenToFlowPosition({x:n,y:o})}const d={id:r,type:null!==(t=l.apiType)&&void 0!==t?t:e,config:Object.assign({},l.defaultConfig)},s=l.toFlowNode(d),c={id:r,type:l.flowType,position:i,data:s,selected:!0};if(U(e=>{const n=e.map(e=>e.selected?Object.assign(Object.assign({},e),{selected:!1}):e);return n.push(c),ue(n,ie.current),n}),Q(r),o){const e=i;requestAnimationFrame(()=>{var n;const a=null===(n=le.current)||void 0===n?void 0:n.querySelector(`[data-id="${CSS.escape(r)}"]`);if(!a)return;const t=a.offsetWidth,l=a.offsetHeight;t&&l&&U(n=>n.map(n=>n.id===r?Object.assign(Object.assign({},n),{position:{x:e.x-o.x*t,y:e.y-o.y*l}}):n))})}},[M,U,ue]),ye=r(e=>{e.preventDefault();const n=e.dataTransfer.getData("application/reactflow");if(!n)return;const[o,a]=e.dataTransfer.getData("application/reactflow-grab-frac").split(","),t={x:Number(o),y:Number(a)},l=M.screenToFlowPosition({x:e.clientX,y:e.clientY});he(n,l,t)},[M,he]),Ce=r(e=>{e.preventDefault(),e.dataTransfer.dropEffect="move"},[]),Le=r(e=>{var n,o,a;const t={id:`${e.source}-${null!==(n=e.sourceHandle)&&void 0!==n?n:""}->${e.target}`,source:e.source,target:e.target,sourceHandle:null!==(o=e.sourceHandle)&&void 0!==o?o:void 0,targetHandle:null!==(a=e.targetHandle)&&void 0!==a?a:void 0,type:R,markerEnd:{type:h.ArrowClosed,width:12,height:12,color:"#94a3b8"}};G(n=>{const o=n.filter(n=>{var o,a;return!(n.source===e.source&&(null!==(o=n.sourceHandle)&&void 0!==o?o:null)===(null!==(a=e.sourceHandle)&&void 0!==a?a:null))}),a=[...o,t];return ue(re.current,a),a})},[G,ue]),ze=r((e,n)=>{G(o=>{var a,t,l;const r=o.filter(o=>{var a,t;return o.id!==e.id&&!(o.source===n.source&&(null!==(a=o.sourceHandle)&&void 0!==a?a:null)===(null!==(t=n.sourceHandle)&&void 0!==t?t:null))}),i=[...r,{id:`${n.source}-${null!==(a=n.sourceHandle)&&void 0!==a?a:""}->${n.target}`,source:n.source,target:n.target,sourceHandle:null!==(t=n.sourceHandle)&&void 0!==t?t:void 0,targetHandle:null!==(l=n.targetHandle)&&void 0!==l?l:void 0,type:R,markerEnd:{type:h.ArrowClosed,width:12,height:12,color:"#94a3b8"}}];return ue(re.current,i),i})},[G,ue]),Ie=r(e=>{var n;if(!e.source||!e.target||e.source!==e.target)return!0;const o=re.current.find(n=>n.id===e.source),a=pe.getByFlowType(null!==(n=null==o?void 0:o.type)&&void 0!==n?n:"");return!0===(null==a?void 0:a.allowSelfLoop)},[re]),Pe=r((e,n,o)=>{var a,t,l;U(a=>{const t=a.map(a=>{var t,l;if(a.id!==e)return a;const r=null===(t=a.data)||void 0===t?void 0:t.originalNode;if(!r)return a;const i=Object.assign(Object.assign({},r),{config:Object.assign(Object.assign({},r.config),n)}),s=pe.getByFlowType(null!==(l=a.type)&&void 0!==l?l:""),c=s?s.toFlowNode(i):Object.assign(Object.assign({},a.data),{originalNode:i}),p=n.target_id,u=p?Z(p,d):void 0;return Object.assign(Object.assign({},a),{data:Object.assign(Object.assign(Object.assign(Object.assign({},a.data),c),o),u&&{targetType:u})})});return ue(t,ie.current),t});const r=null!==(t=null===(a=re.current.find(n=>n.id===e))||void 0===a?void 0:a.type)&&void 0!==t?t:"",i=pe.getByFlowType(r),s=i?ge.find(e=>{var n;return e.type===(null!==(n=i.apiType)&&void 0!==n?n:i.type)}):null;null===(l=null==s?void 0:s.onConfigChange)||void 0===l||l.call(s,e,n,{setEdges:G,updateNodeInternals:H,nodesRef:re,updateDirty:ue}),n.target_id&&requestAnimationFrame(()=>H(e))},[U,G,ue,H]),De=r(()=>{const{nodes:e,edges:n}=xe(W,q);U(e),G(n),ue(e,n),requestAnimationFrame(()=>M.fitView({padding:.2}))},[W,q,U,G,ue,M]),Me=r((e,n)=>S(this,void 0,void 0,function*(){var o;try{const t={expand:["extensions"]};switch(e){case"schedule":return yield D.schedules.list();case"user":return(yield D.users.list(t)).map(e=>{var n,o,a;return{id:e.id,name:e.name||d.combobox.noName,extension_number:null===(a=null===(o=null===(n=e.extensions)||void 0===n?void 0:n.data)||void 0===o?void 0:o[0])||void 0===a?void 0:a.number}});case"ring_group":return yield D.ringGroups.list(t);case"queue":return yield D.queues.list({expand:t.expand});case"dial_plan":{const e=yield D.dialPlans.list(t),n=null!==(o=null==ae?void 0:ae.id)&&void 0!==o?o:a;return e.filter(e=>e.id!==n)}case"voice_app":{const e=yield D.voiceApps.list(t);if(!(null==n?void 0:n.notifyEligible))return e;try{const n=yield D.aiAgents.list({limit:100}),o=new Set(n.map(e=>e.voice_app_id));return e.filter(e=>!o.has(e.id))}catch(n){return e}}case"shared_voicemail":return yield D.sharedVoicemailBoxes.list();case"audio_clip":return yield D.audioClips.list();default:return[]}}catch(e){return[]}}),[D,a,ae,d]),He=r(()=>S(this,void 0,void 0,function*(){var e,n,o,t,l,r;try{const l=re.current,r=ie.current,i=_e(l,r,pe),s=a?yield D.dialPlans.update(a,i):yield D.dialPlans.create(Object.assign({name:d.status.newDialPlan},i));se.current={nodes:[...l],edges:[...r]},oe(!1),null===(n=(e=de.current).onDirtyChange)||void 0===n||n.call(e,!1),null===(t=(o=de.current).onSave)||void 0===t||t.call(o,s)}catch(e){const n=e instanceof Error?e:new Error(String(e)),o=n.message.includes("/nodes/")?_e(re.current,ie.current,pe):null;if(o){const e=n.message.match(/^\/nodes\/(\d+)\//);if(null==e?void 0:e[1]){const n=o.nodes[parseInt(e[1],10)];n&&Q(n.id)}}throw null===(r=(l=de.current).onError)||void 0===r||r.call(l,new Error(function(e,n){var o,a,t;if(e.startsWith("voice_app notify mode is not supported on AI agent voice apps"))return"A Voice App used in Notify mode is backed by an AI agent. AI-agent voice apps must use Control mode.";const l=e.indexOf(": "),r=l>0&&e.startsWith("/")?e.slice(0,l):"",i=l>0?e.slice(l+2):e,d=r.split("/").filter(Boolean);if("entry_node"===d[0])return"The Start node must be connected to another node";if("nodes"===d[0]&&i.includes("minItems"))return"The dial plan must have at least one node";if("nodes"===d[0]&&"config"===d[2]&&d[3]){const e=d[3];if(Se[e])return Se[e];const l=parseInt(null!==(o=d[1])&&void 0!==o?o:"",10),r=isNaN(l)||null===(a=null==n?void 0:n[l])||void 0===a?void 0:a.type,i=r?null!==(t=Re[r])&&void 0!==t?t:r:void 0;return i?`Invalid ${e.replace(/_/g," ")} in the ${i} node`:`Invalid ${e.replace(/_/g," ")}`}return r?i:e}(n.message,null==o?void 0:o.nodes))),e}}),[D,a]);i(j,()=>({save:He}),[He]);const $e=r((e,n)=>{"__start__"!==n.id&&(Q(n.id),ee(null))},[]),Ke=r((e,n)=>{ee(n.id),Q(null)},[]),Be=r(e=>{const n=ie.current.filter(n=>n.id!==e);G(n),ue(re.current,n),ee(null)},[G,ue]),Ve=r(()=>{Q(null),ee(null)},[]),We=r((e,n)=>{var o;if(!s)return;if("__start__"===n.id)return;const a=null===(o=n.data)||void 0===o?void 0:o.originalNode;a&&s(n.id,a)},[s]),Ue=X?W.find(e=>e.id===X):null,qe=Ue?pe.getByFlowType(null!==(A=Ue.type)&&void 0!==A?A:""):null,Ge=J?q.find(e=>e.id===J):null,Ye=!(!Ue||!qe)||!!Ge;if($)return e.createElement("div",{className:`ds-dial-plan-viewer ds-dial-plan-viewer--loading ${L||""}`,style:z},e.createElement("div",{className:"ds-dial-plan-viewer__loading"},e.createElement("div",{className:"ds-dial-plan-viewer__spinner"}),e.createElement("span",null,d.status.loading)));if(B)return e.createElement("div",{className:`ds-dial-plan-viewer ds-dial-plan-viewer--error ${L||""}`,style:z},e.createElement("div",{className:"ds-dial-plan-viewer__error"},e.createElement("span",null,d.status.loadError),e.createElement("span",{className:"ds-dial-plan-viewer__error-message"},B.message)));if(!F&&0===W.length)return e.createElement("div",{className:`ds-dial-plan-viewer ds-dial-plan-viewer--empty ${L||""}`,style:z},e.createElement("div",{className:"ds-dial-plan-viewer__empty"},e.createElement("span",null,d.status.notFound)));const Xe=e.createElement(x,{nodes:W,edges:q,nodeTypes:Ae,edgeTypes:Fe,onNodesChange:F?me:void 0,onEdgesChange:F?fe:void 0,onConnect:F?Le:void 0,onReconnect:F?ze:void 0,onEdgeClick:F?Ke:void 0,isValidConnection:F?Ie:void 0,edgesReconnectable:F,onNodeClick:F?$e:s?We:void 0,onPaneClick:F?Ve:void 0,nodesDraggable:F,nodesConnectable:F,elementsSelectable:F,selectionOnDrag:!1,selectNodesOnDrag:!1,panOnDrag:I,panOnScroll:!1,zoomOnScroll:I,zoomOnPinch:I,zoomOnDoubleClick:I,preventScrolling:I,connectionLineType:y.SmoothStep,selectionKeyCode:null,multiSelectionKeyCode:null,deleteKeyCode:F?["Backspace","Delete"]:null,fitView:!0,fitViewOptions:{padding:I?.2:.15,minZoom:I?.5:0,maxZoom:1.5},minZoom:I?.3:0,maxZoom:2,defaultEdgeOptions:{type:R,animated:!1,markerEnd:{type:h.ArrowClosed,width:12,height:12,color:"#94a3b8"}},proOptions:{hideAttribution:!0}},P&&e.createElement(w,{gap:20,size:1}),P&&e.createElement(k,{showInteractive:!1}),F&&e.createElement(Ne,{onAutoLayout:De,onSave:()=>{He().catch(()=>{})},isDirty:ne}));return e.createElement("div",{className:`ds-dial-plan-editor ${"preview"===l?"ds-dial-plan-editor--preview":""} ${L||""}`,style:z},F&&e.createElement("div",{className:"ds-dial-plan-node-library-wrapper"},e.createElement(we,{registry:pe,onAddNode:he})),e.createElement("div",{ref:le,className:"ds-dial-plan-editor__canvas",onDrop:F?ye:void 0,onDragOver:F?Ce:void 0},Xe),F&&e.createElement("div",{className:"ds-dial-plan-config-panel-wrapper"+(Ye?" ds-dial-plan-config-panel-wrapper--open":"")},Ue&&qe&&e.createElement(Ee,{node:Ue,registration:qe,onConfigChange:Pe,onDelete:be,onClose:()=>{Q(null),U(e=>e.map(e=>e.selected?Object.assign(Object.assign({},e),{selected:!1}):e))},listResources:Me,onCreateResource:O,onOpenResource:T,locale:d}),Ge&&e.createElement("div",{className:"ds-dial-plan-config-panel"},e.createElement("div",{className:"ds-dial-plan-config-panel__header"},e.createElement("span",{className:"ds-dial-plan-config-panel__header-icon"},e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M4 8h8v8h8"}),e.createElement("polyline",{points:"17 13 20 16 17 19"}))),e.createElement("span",{className:"ds-dial-plan-config-panel__header-label"},d.panel.connection),e.createElement("button",{type:"button",className:"ds-dial-plan-config-panel__delete",onClick:()=>Be(Ge.id),title:d.panel.delete_},ke),e.createElement("button",{type:"button",className:"ds-dial-plan-config-panel__close",onClick:()=>{ee(null),G(e=>e.map(e=>e.selected?Object.assign(Object.assign({},e),{selected:!1}):e))},title:d.panel.close},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})))),e.createElement("div",{className:"ds-dial-plan-config-panel__body"},e.createElement("div",{className:"ds-dial-plan-config-field"},e.createElement("span",{className:"ds-dial-plan-config-field__label"},d.panel.from),e.createElement("span",{className:"ds-dial-plan-edge-panel__value"},(()=>{var e,n,o;const a=W.find(e=>e.id===Ge.source),t=a?pe.getByFlowType(null!==(e=a.type)&&void 0!==e?e:""):null,l=null!==(o=null!==(n=null==t?void 0:t.label)&&void 0!==n?n:null==a?void 0:a.type)&&void 0!==o?o:Ge.source;return l.charAt(0).toUpperCase()+l.slice(1)})())),Ge.sourceHandle&&e.createElement("div",{className:"ds-dial-plan-config-field"},e.createElement("span",{className:"ds-dial-plan-config-field__label"},d.panel.exit),e.createElement("span",{className:"ds-dial-plan-edge-panel__value"},(()=>{var e,n,o,a,t;const l=Ge.sourceHandle,r=W.find(e=>e.id===Ge.source),i=r?pe.getByFlowType(null!==(e=r.type)&&void 0!==e?e:""):null,d=i?ge.find(e=>{var n;return e.type===(null!==(n=i.apiType)&&void 0!==n?n:i.type)}):null;return null!==(t=null!==(o=null===(n=null==d?void 0:d.resolveExitLabel)||void 0===n?void 0:n.call(d,l))&&void 0!==o?o:null===(a=null==i?void 0:i.exits.find(e=>e.id===l))||void 0===a?void 0:a.label)&&void 0!==t?t:l})())),e.createElement("div",{className:"ds-dial-plan-config-field"},e.createElement("span",{className:"ds-dial-plan-config-field__label"},d.panel.to),e.createElement("span",{className:"ds-dial-plan-edge-panel__value"},(()=>{var e,n,o;const a=W.find(e=>e.id===Ge.target),t=a?pe.getByFlowType(null!==(e=a.type)&&void 0!==e?e:""):null,l=null!==(o=null!==(n=null==t?void 0:t.label)&&void 0!==n?n:null==a?void 0:a.type)&&void 0!==o?o:Ge.target;return l.charAt(0).toUpperCase()+l.slice(1)})()))))))}),Pe=["/* this gets exported as style.css and can be used for the default theming */\n/* these are the necessary styles for React/Svelte Flow, they get used by base.css and style.css */\n.react-flow {\n direction: ltr;\n\n --xy-edge-stroke-default: #b1b1b7;\n --xy-edge-stroke-width-default: 1;\n --xy-edge-stroke-selected-default: #555;\n\n --xy-connectionline-stroke-default: #b1b1b7;\n --xy-connectionline-stroke-width-default: 1;\n\n --xy-attribution-background-color-default: rgba(255, 255, 255, 0.5);\n\n --xy-minimap-background-color-default: #fff;\n --xy-minimap-mask-background-color-default: rgba(240, 240, 240, 0.6);\n --xy-minimap-mask-stroke-color-default: transparent;\n --xy-minimap-mask-stroke-width-default: 1;\n --xy-minimap-node-background-color-default: #e2e2e2;\n --xy-minimap-node-stroke-color-default: transparent;\n --xy-minimap-node-stroke-width-default: 2;\n\n --xy-background-color-default: transparent;\n --xy-background-pattern-dots-color-default: #91919a;\n --xy-background-pattern-lines-color-default: #eee;\n --xy-background-pattern-cross-color-default: #e2e2e2;\n background-color: var(--xy-background-color, var(--xy-background-color-default));\n --xy-node-color-default: inherit;\n --xy-node-border-default: 1px solid #1a192b;\n --xy-node-background-color-default: #fff;\n --xy-node-group-background-color-default: rgba(240, 240, 240, 0.25);\n --xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, 0.08);\n --xy-node-boxshadow-selected-default: 0 0 0 0.5px #1a192b;\n --xy-node-border-radius-default: 3px;\n\n --xy-handle-background-color-default: #1a192b;\n --xy-handle-border-color-default: #fff;\n\n --xy-selection-background-color-default: rgba(0, 89, 220, 0.08);\n --xy-selection-border-default: 1px dotted rgba(0, 89, 220, 0.8);\n\n --xy-controls-button-background-color-default: #fefefe;\n --xy-controls-button-background-color-hover-default: #f4f4f4;\n --xy-controls-button-color-default: inherit;\n --xy-controls-button-color-hover-default: inherit;\n --xy-controls-button-border-color-default: #eee;\n --xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, 0.08);\n\n --xy-edge-label-background-color-default: #ffffff;\n --xy-edge-label-color-default: inherit;\n --xy-resize-background-color-default: #3367d9;\n}\n.react-flow.dark {\n --xy-edge-stroke-default: #3e3e3e;\n --xy-edge-stroke-width-default: 1;\n --xy-edge-stroke-selected-default: #727272;\n\n --xy-connectionline-stroke-default: #b1b1b7;\n --xy-connectionline-stroke-width-default: 1;\n\n --xy-attribution-background-color-default: rgba(150, 150, 150, 0.25);\n\n --xy-minimap-background-color-default: #141414;\n --xy-minimap-mask-background-color-default: rgba(60, 60, 60, 0.6);\n --xy-minimap-mask-stroke-color-default: transparent;\n --xy-minimap-mask-stroke-width-default: 1;\n --xy-minimap-node-background-color-default: #2b2b2b;\n --xy-minimap-node-stroke-color-default: transparent;\n --xy-minimap-node-stroke-width-default: 2;\n\n --xy-background-color-default: #141414;\n --xy-background-pattern-dots-color-default: #555;\n --xy-background-pattern-lines-color-default: #333;\n --xy-background-pattern-cross-color-default: #333;\n --xy-node-color-default: #f8f8f8;\n --xy-node-border-default: 1px solid #3c3c3c;\n --xy-node-background-color-default: #1e1e1e;\n --xy-node-group-background-color-default: rgba(240, 240, 240, 0.25);\n --xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, 0.08);\n --xy-node-boxshadow-selected-default: 0 0 0 0.5px #999;\n\n --xy-handle-background-color-default: #bebebe;\n --xy-handle-border-color-default: #1e1e1e;\n\n --xy-selection-background-color-default: rgba(200, 200, 220, 0.08);\n --xy-selection-border-default: 1px dotted rgba(200, 200, 220, 0.8);\n\n --xy-controls-button-background-color-default: #2b2b2b;\n --xy-controls-button-background-color-hover-default: #3e3e3e;\n --xy-controls-button-color-default: #f8f8f8;\n --xy-controls-button-color-hover-default: #fff;\n --xy-controls-button-border-color-default: #5b5b5b;\n --xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, 0.08);\n\n --xy-edge-label-background-color-default: #141414;\n --xy-edge-label-color-default: #f8f8f8;\n}\n.react-flow__background {\n background-color: var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));\n pointer-events: none;\n z-index: -1;\n}\n.react-flow__container {\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n}\n.react-flow__pane {\n z-index: 1;\n touch-action: none;\n}\n.react-flow__pane.draggable {\n cursor: grab;\n }\n.react-flow__pane.dragging {\n cursor: grabbing;\n }\n.react-flow__pane.selection {\n cursor: pointer;\n }\n.react-flow__viewport {\n transform-origin: 0 0;\n z-index: 2;\n pointer-events: none;\n}\n.react-flow__renderer {\n z-index: 4;\n}\n.react-flow__selection {\n z-index: 6;\n}\n.react-flow__nodesselection-rect:focus,\n.react-flow__nodesselection-rect:focus-visible {\n outline: none;\n}\n.react-flow__edge-path {\n stroke: var(--xy-edge-stroke, var(--xy-edge-stroke-default));\n stroke-width: var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));\n fill: none;\n}\n.react-flow__connection-path {\n stroke: var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));\n stroke-width: var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));\n fill: none;\n}\n.react-flow .react-flow__edges {\n position: absolute;\n}\n.react-flow .react-flow__edges svg {\n overflow: visible;\n position: absolute;\n pointer-events: none;\n }\n.react-flow__edge {\n pointer-events: visibleStroke;\n}\n.react-flow__edge.selectable {\n cursor: pointer;\n }\n.react-flow__edge.animated path {\n stroke-dasharray: 5;\n animation: dashdraw 0.5s linear infinite;\n }\n.react-flow__edge.animated path.react-flow__edge-interaction {\n stroke-dasharray: none;\n animation: none;\n }\n.react-flow__edge.inactive {\n pointer-events: none;\n }\n.react-flow__edge.selected,\n .react-flow__edge:focus,\n .react-flow__edge:focus-visible {\n outline: none;\n }\n.react-flow__edge.selected .react-flow__edge-path,\n .react-flow__edge.selectable:focus .react-flow__edge-path,\n .react-flow__edge.selectable:focus-visible .react-flow__edge-path {\n stroke: var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default));\n }\n.react-flow__edge-textwrapper {\n pointer-events: all;\n }\n.react-flow__edge .react-flow__edge-text {\n pointer-events: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n }\n/* Arrowhead marker styles - use CSS custom properties as default */\n.react-flow__arrowhead polyline {\n stroke: var(--xy-edge-stroke, var(--xy-edge-stroke-default));\n}\n.react-flow__arrowhead polyline.arrowclosed {\n fill: var(--xy-edge-stroke, var(--xy-edge-stroke-default));\n}\n.react-flow__connection {\n pointer-events: none;\n}\n.react-flow__connection .animated {\n stroke-dasharray: 5;\n animation: dashdraw 0.5s linear infinite;\n }\nsvg.react-flow__connectionline {\n z-index: 1001;\n overflow: visible;\n position: absolute;\n}\n.react-flow__nodes {\n pointer-events: none;\n transform-origin: 0 0;\n}\n.react-flow__node {\n position: absolute;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n pointer-events: all;\n transform-origin: 0 0;\n box-sizing: border-box;\n cursor: default;\n}\n.react-flow__node.selectable {\n cursor: pointer;\n }\n.react-flow__node.draggable {\n cursor: grab;\n pointer-events: all;\n }\n.react-flow__node.draggable.dragging {\n cursor: grabbing;\n }\n.react-flow__nodesselection {\n z-index: 3;\n transform-origin: left top;\n pointer-events: none;\n}\n.react-flow__nodesselection-rect {\n position: absolute;\n pointer-events: all;\n cursor: grab;\n }\n.react-flow__handle {\n position: absolute;\n pointer-events: none;\n min-width: 5px;\n min-height: 5px;\n width: 6px;\n height: 6px;\n background-color: var(--xy-handle-background-color, var(--xy-handle-background-color-default));\n border: 1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));\n border-radius: 100%;\n}\n.react-flow__handle.connectingfrom {\n pointer-events: all;\n }\n.react-flow__handle.connectionindicator {\n pointer-events: all;\n cursor: crosshair;\n }\n.react-flow__handle-bottom {\n top: auto;\n left: 50%;\n bottom: 0;\n transform: translate(-50%, 50%);\n }\n.react-flow__handle-top {\n top: 0;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n.react-flow__handle-left {\n top: 50%;\n left: 0;\n transform: translate(-50%, -50%);\n }\n.react-flow__handle-right {\n top: 50%;\n right: 0;\n transform: translate(50%, -50%);\n }\n.react-flow__edgeupdater {\n cursor: move;\n pointer-events: all;\n}\n.react-flow__pane.selection .react-flow__panel {\n pointer-events: none;\n}\n.react-flow__panel {\n position: absolute;\n z-index: 5;\n margin: 15px;\n}\n.react-flow__panel.top {\n top: 0;\n }\n.react-flow__panel.bottom {\n bottom: 0;\n }\n.react-flow__panel.top.center, .react-flow__panel.bottom.center {\n left: 50%;\n transform: translateX(-15px) translateX(-50%);\n }\n.react-flow__panel.left {\n left: 0;\n }\n.react-flow__panel.right {\n right: 0;\n }\n.react-flow__panel.left.center, .react-flow__panel.right.center {\n top: 50%;\n transform: translateY(-15px) translateY(-50%);\n }\n.react-flow__attribution {\n font-size: 10px;\n background: var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));\n padding: 2px 3px;\n margin: 0;\n}\n.react-flow__attribution a {\n text-decoration: none;\n color: #999;\n }\n@keyframes dashdraw {\n from {\n stroke-dashoffset: 10;\n }\n}\n.react-flow__edgelabel-renderer {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n left: 0;\n top: 0;\n}\n.react-flow__viewport-portal {\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n.react-flow__minimap {\n background: var(\n --xy-minimap-background-color-props,\n var(--xy-minimap-background-color, var(--xy-minimap-background-color-default))\n );\n}\n.react-flow__minimap-svg {\n display: block;\n }\n.react-flow__minimap-mask {\n fill: var(\n --xy-minimap-mask-background-color-props,\n var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default))\n );\n stroke: var(\n --xy-minimap-mask-stroke-color-props,\n var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default))\n );\n stroke-width: var(\n --xy-minimap-mask-stroke-width-props,\n var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default))\n );\n }\n.react-flow__minimap-node {\n fill: var(\n --xy-minimap-node-background-color-props,\n var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default))\n );\n stroke: var(\n --xy-minimap-node-stroke-color-props,\n var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default))\n );\n stroke-width: var(\n --xy-minimap-node-stroke-width-props,\n var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default))\n );\n }\n.react-flow__background-pattern.dots {\n fill: var(\n --xy-background-pattern-color-props,\n var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default))\n );\n }\n.react-flow__background-pattern.lines {\n stroke: var(\n --xy-background-pattern-color-props,\n var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default))\n );\n }\n.react-flow__background-pattern.cross {\n stroke: var(\n --xy-background-pattern-color-props,\n var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default))\n );\n }\n.react-flow__controls {\n display: flex;\n flex-direction: column;\n box-shadow: var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default));\n}\n.react-flow__controls.horizontal {\n flex-direction: row;\n }\n.react-flow__controls-button {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 26px;\n width: 26px;\n padding: 4px;\n border: none;\n background: var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));\n border-bottom: 1px solid\n var(\n --xy-controls-button-border-color-props,\n var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default))\n );\n color: var(\n --xy-controls-button-color-props,\n var(--xy-controls-button-color, var(--xy-controls-button-color-default))\n );\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n }\n.react-flow__controls-button svg {\n width: 100%;\n max-width: 12px;\n max-height: 12px;\n fill: currentColor;\n }\n.react-flow__edge.updating .react-flow__edge-path {\n stroke: #777;\n }\n.react-flow__edge-text {\n font-size: 10px;\n }\n.react-flow__node.selectable:focus,\n .react-flow__node.selectable:focus-visible {\n outline: none;\n }\n.react-flow__node-input,\n.react-flow__node-default,\n.react-flow__node-output,\n.react-flow__node-group {\n padding: 10px;\n border-radius: var(--xy-node-border-radius, var(--xy-node-border-radius-default));\n width: 150px;\n font-size: 12px;\n color: var(--xy-node-color, var(--xy-node-color-default));\n text-align: center;\n border: var(--xy-node-border, var(--xy-node-border-default));\n background-color: var(--xy-node-background-color, var(--xy-node-background-color-default));\n}\n.react-flow__node-input.selectable:hover, .react-flow__node-default.selectable:hover, .react-flow__node-output.selectable:hover, .react-flow__node-group.selectable:hover {\n box-shadow: var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default));\n }\n.react-flow__node-input.selectable.selected,\n .react-flow__node-input.selectable:focus,\n .react-flow__node-input.selectable:focus-visible,\n .react-flow__node-default.selectable.selected,\n .react-flow__node-default.selectable:focus,\n .react-flow__node-default.selectable:focus-visible,\n .react-flow__node-output.selectable.selected,\n .react-flow__node-output.selectable:focus,\n .react-flow__node-output.selectable:focus-visible,\n .react-flow__node-group.selectable.selected,\n .react-flow__node-group.selectable:focus,\n .react-flow__node-group.selectable:focus-visible {\n box-shadow: var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default));\n }\n.react-flow__node-group {\n background-color: var(--xy-node-group-background-color, var(--xy-node-group-background-color-default));\n}\n.react-flow__nodesselection-rect,\n.react-flow__selection {\n background: var(--xy-selection-background-color, var(--xy-selection-background-color-default));\n border: var(--xy-selection-border, var(--xy-selection-border-default));\n}\n.react-flow__nodesselection-rect:focus,\n .react-flow__nodesselection-rect:focus-visible,\n .react-flow__selection:focus,\n .react-flow__selection:focus-visible {\n outline: none;\n }\n.react-flow__controls-button:hover {\n background: var(\n --xy-controls-button-background-color-hover-props,\n var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default))\n );\n color: var(\n --xy-controls-button-color-hover-props,\n var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default))\n );\n }\n.react-flow__controls-button:disabled {\n pointer-events: none;\n }\n.react-flow__controls-button:disabled svg {\n fill-opacity: 0.4;\n }\n.react-flow__controls-button:last-child {\n border-bottom: none;\n }\n.react-flow__controls.horizontal .react-flow__controls-button {\n border-bottom: none;\n border-right: 1px solid\n var(\n --xy-controls-button-border-color-props,\n var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default))\n );\n }\n.react-flow__controls.horizontal .react-flow__controls-button:last-child {\n border-right: none;\n }\n.react-flow__resize-control {\n position: absolute;\n}\n.react-flow__resize-control.left,\n.react-flow__resize-control.right {\n cursor: ew-resize;\n}\n.react-flow__resize-control.top,\n.react-flow__resize-control.bottom {\n cursor: ns-resize;\n}\n.react-flow__resize-control.top.left,\n.react-flow__resize-control.bottom.right {\n cursor: nwse-resize;\n}\n.react-flow__resize-control.bottom.left,\n.react-flow__resize-control.top.right {\n cursor: nesw-resize;\n}\n/* handle styles */\n.react-flow__resize-control.handle {\n width: 5px;\n height: 5px;\n border: 1px solid #fff;\n border-radius: 1px;\n background-color: var(--xy-resize-background-color, var(--xy-resize-background-color-default));\n translate: -50% -50%;\n}\n.react-flow__resize-control.handle.left {\n left: 0;\n top: 50%;\n}\n.react-flow__resize-control.handle.right {\n left: 100%;\n top: 50%;\n}\n.react-flow__resize-control.handle.top {\n left: 50%;\n top: 0;\n}\n.react-flow__resize-control.handle.bottom {\n left: 50%;\n top: 100%;\n}\n.react-flow__resize-control.handle.top.left {\n left: 0;\n}\n.react-flow__resize-control.handle.bottom.left {\n left: 0;\n}\n.react-flow__resize-control.handle.top.right {\n left: 100%;\n}\n.react-flow__resize-control.handle.bottom.right {\n left: 100%;\n}\n/* line styles */\n.react-flow__resize-control.line {\n border-color: var(--xy-resize-background-color, var(--xy-resize-background-color-default));\n border-width: 0;\n border-style: solid;\n}\n.react-flow__resize-control.line.left,\n.react-flow__resize-control.line.right {\n width: 1px;\n transform: translate(-50%, 0);\n top: 0;\n height: 100%;\n}\n.react-flow__resize-control.line.left {\n left: 0;\n border-left-width: 1px;\n}\n.react-flow__resize-control.line.right {\n left: 100%;\n border-right-width: 1px;\n}\n.react-flow__resize-control.line.top,\n.react-flow__resize-control.line.bottom {\n height: 1px;\n transform: translate(0, -50%);\n left: 0;\n width: 100%;\n}\n.react-flow__resize-control.line.top {\n top: 0;\n border-top-width: 1px;\n}\n.react-flow__resize-control.line.bottom {\n border-bottom-width: 1px;\n top: 100%;\n}\n.react-flow__edge-textbg {\n fill: var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default));\n}\n.react-flow__edge-text {\n fill: var(--xy-edge-label-color, var(--xy-edge-label-color-default));\n}\n",'\n/* ============================================================================\n Shadow DOM Reset\n ============================================================================ */\n\n:host {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n}\n\n*, *::before, *::after {\n box-sizing: border-box;\n}\n\n/* ============================================================================\n Container\n ============================================================================ */\n\n.ds-dial-plan-viewer {\n width: 100%;\n height: 100%;\n background: var(--ds-color-background, #ffffff);\n border-radius: var(--ds-border-radius, 8px);\n overflow: hidden;\n}\n\n/* ============================================================================\n Base Node Styles\n ============================================================================ */\n\n.ds-dial-plan-node {\n padding: 12px 16px;\n border-radius: var(--ds-border-radius, 8px);\n border: 2px solid var(--ds-color-border, #e2e8f0);\n background: var(--ds-color-background, #ffffff);\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n transition: border-color 0.15s ease, box-shadow 0.15s ease, outline-color 0.15s ease;\n min-width: 140px;\n outline: 3px solid transparent;\n outline-offset: 2px;\n}\n\n.ds-dial-plan-node--selected {\n border-color: var(--ds-color-primary, #3b82f6);\n outline-color: var(--ds-color-primary, #3b82f6);\n box-shadow: 0 0 16px 2px rgba(59, 130, 246, 0.4), 0 4px 12px rgba(59, 130, 246, 0.2);\n}\n\n.ds-dial-plan-node__content,\n.ds-dial-plan-node__header {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n}\n\n.ds-dial-plan-node__icon {\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-dial-plan-node__label {\n font-weight: 600;\n color: var(--ds-color-text, #1e293b);\n text-align: center;\n}\n\n.ds-dial-plan-node__type-label {\n font-size: var(--ds-font-size-xs, 12px);\n font-weight: 500;\n color: var(--ds-color-text-secondary, #64748b);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n}\n\n.ds-dial-plan-node__name {\n font-weight: 600;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text, #1e293b);\n text-align: center;\n}\n\n.ds-dial-plan-node__type {\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-dial-plan-node__exits {\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin-top: 12px;\n padding-top: 10px;\n border-top: 1px solid var(--ds-color-border, #e2e8f0);\n}\n\n.ds-dial-plan-node__exit-row {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 8px;\n position: relative;\n}\n\n.ds-dial-plan-node__exit-label {\n font-size: 11px;\n color: var(--ds-color-text-secondary, #64748b);\n white-space: nowrap;\n}\n\n/* Position handles at the right edge of exit rows */\n.ds-dial-plan-node__exit-row .ds-dial-plan-handle {\n position: absolute;\n right: -16px;\n}\n\n/* ============================================================================\n Start Node\n ============================================================================ */\n\n.ds-dial-plan-node--start {\n background: var(--ds-color-primary, #3b82f6);\n border-color: var(--ds-color-primary, #3b82f6);\n border-radius: 50%;\n width: 60px;\n height: 60px;\n min-width: auto;\n padding: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.ds-dial-plan-node--start .ds-dial-plan-node__content {\n flex-direction: row;\n}\n\n.ds-dial-plan-node--start .ds-dial-plan-node__label {\n color: #ffffff;\n font-size: var(--ds-font-size-sm, 14px);\n}\n\n/* ============================================================================\n Node color theming (driven by --node-color CSS variable from registration)\n ============================================================================ */\n\n.ds-dial-plan-node--themed {\n border-color: var(--node-color);\n background: color-mix(in srgb, var(--node-color) 8%, white);\n}\n\n.ds-dial-plan-node--themed .ds-dial-plan-node__icon {\n color: var(--node-color);\n}\n\n.ds-dial-plan-node--themed.ds-dial-plan-node--selected {\n border-color: var(--node-color);\n outline-color: var(--node-color);\n box-shadow: 0 0 16px 2px color-mix(in srgb, var(--node-color) 40%, transparent),\n 0 4px 12px color-mix(in srgb, var(--node-color) 20%, transparent);\n}\n\n/* ============================================================================\n Per-type node colors (override --themed fallback with hand-crafted gradients)\n ============================================================================ */\n\n.ds-dial-plan-node--schedule {\n background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);\n border-color: var(--ds-color-info, #0ea5e9);\n min-height: 80px;\n}\n.ds-dial-plan-node--schedule .ds-dial-plan-node__icon { color: var(--ds-color-info, #0ea5e9); }\n.ds-dial-plan-node--schedule.ds-dial-plan-node--selected {\n border-color: var(--ds-color-info, #0ea5e9);\n outline-color: var(--ds-color-info, #0ea5e9);\n box-shadow: 0 0 16px 2px rgba(14, 165, 233, 0.4), 0 4px 12px rgba(14, 165, 233, 0.2);\n}\n\n.ds-dial-plan-node--internal-dial {\n background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);\n border-color: var(--ds-color-success, #22c55e);\n}\n.ds-dial-plan-node--internal-dial .ds-dial-plan-node__icon { color: var(--ds-color-success, #22c55e); }\n.ds-dial-plan-node--internal-dial.ds-dial-plan-node--selected {\n border-color: var(--ds-color-success, #22c55e);\n outline-color: var(--ds-color-success, #22c55e);\n box-shadow: 0 0 16px 2px rgba(34, 197, 94, 0.4), 0 4px 12px rgba(34, 197, 94, 0.2);\n}\n\n.ds-dial-plan-node--voicemail {\n background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);\n border-color: var(--ds-color-purple, #a855f7);\n}\n.ds-dial-plan-node--voicemail .ds-dial-plan-node__icon { color: var(--ds-color-purple, #a855f7); }\n.ds-dial-plan-node--voicemail.ds-dial-plan-node--selected {\n border-color: var(--ds-color-purple, #a855f7);\n outline-color: var(--ds-color-purple, #a855f7);\n box-shadow: 0 0 16px 2px rgba(168, 85, 247, 0.4), 0 4px 12px rgba(168, 85, 247, 0.2);\n}\n\n.ds-dial-plan-node--ring-all-users {\n background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);\n border-color: var(--ds-color-warning, #f59e0b);\n}\n.ds-dial-plan-node--ring-all-users .ds-dial-plan-node__icon { color: var(--ds-color-warning, #f59e0b); }\n.ds-dial-plan-node--ring-all-users.ds-dial-plan-node--selected {\n border-color: var(--ds-color-warning, #f59e0b);\n outline-color: var(--ds-color-warning, #f59e0b);\n box-shadow: 0 0 16px 2px rgba(245, 158, 11, 0.4), 0 4px 12px rgba(245, 158, 11, 0.2);\n}\n\n.ds-dial-plan-node--external-dial {\n background: linear-gradient(135deg, #fff1f2 0%, #fecdd3 100%);\n border-color: var(--ds-color-rose, #f43f5e);\n}\n.ds-dial-plan-node--external-dial .ds-dial-plan-node__icon { color: var(--ds-color-rose, #f43f5e); }\n.ds-dial-plan-node--external-dial.ds-dial-plan-node--selected {\n border-color: var(--ds-color-rose, #f43f5e);\n outline-color: var(--ds-color-rose, #f43f5e);\n box-shadow: 0 0 16px 2px rgba(244, 63, 94, 0.4), 0 4px 12px rgba(244, 63, 94, 0.2);\n}\n\n.ds-dial-plan-node--voice-app {\n border: 2px solid transparent;\n background:\n linear-gradient(135deg, #c7d2fe 0%, #ddd6fe 40%, #bae6fd 100%) padding-box,\n linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box;\n position: relative;\n transition: box-shadow 0.15s ease;\n}\n.ds-dial-plan-node--voice-app .ds-dial-plan-node__icon { color: #4f46e5; }\n.ds-dial-plan-node--voice-app.ds-dial-plan-node--selected {\n border-color: transparent;\n outline: none;\n box-shadow: 0 0 16px 2px rgba(99, 102, 241, 0.4), 0 4px 12px rgba(56, 189, 248, 0.2);\n}\n.ds-dial-plan-node--voice-app::after {\n content: \'\';\n position: absolute;\n inset: -7px;\n border-radius: calc(var(--ds-border-radius, 8px) + 5px);\n border: 3px solid transparent;\n background: linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box;\n -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);\n -webkit-mask-composite: xor;\n mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);\n mask-composite: exclude;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.15s ease;\n z-index: -1;\n}\n.ds-dial-plan-node--voice-app.ds-dial-plan-node--selected::after { opacity: 1; }\n\n.ds-dial-plan-node--menu {\n background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);\n border-color: #ec4899;\n}\n.ds-dial-plan-node--menu .ds-dial-plan-node__icon { color: #ec4899; }\n.ds-dial-plan-node--menu.ds-dial-plan-node--selected {\n border-color: #ec4899;\n outline-color: #ec4899;\n box-shadow: 0 0 16px 2px rgba(236, 72, 153, 0.4), 0 4px 12px rgba(236, 72, 153, 0.2);\n}\n\n.ds-dial-plan-node--audio-clip {\n background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);\n border-color: #14b8a6;\n}\n.ds-dial-plan-node--audio-clip .ds-dial-plan-node__icon { color: #14b8a6; }\n.ds-dial-plan-node--audio-clip.ds-dial-plan-node--selected {\n border-color: #14b8a6;\n outline-color: #14b8a6;\n box-shadow: 0 0 16px 2px rgba(20, 184, 166, 0.4), 0 4px 12px rgba(20, 184, 166, 0.2);\n}\n\n/* ============================================================================\n Menu Config Panel — Options List\n ============================================================================ */\n\n.ds-dial-plan-config-field__header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 6px;\n}\n\n.ds-dial-plan-config-field__header .ds-dial-plan-config-field__label {\n margin: 0;\n}\n\n.ds-dial-plan-menu-options {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n\n.ds-dial-plan-menu-options__card {\n display: flex;\n align-items: flex-end;\n gap: 6px;\n}\n\n.ds-dial-plan-menu-options__field {\n display: flex;\n flex-direction: column;\n gap: 4px;\n min-width: 0;\n}\n\n.ds-dial-plan-menu-options__field--digit {\n flex: 0 0 64px;\n}\n\n.ds-dial-plan-menu-options__field--label {\n flex: 1;\n}\n\n.ds-dial-plan-menu-options__field-label {\n font-size: 10px;\n font-weight: 600;\n letter-spacing: 0.05em;\n text-transform: uppercase;\n color: var(--ds-color-text-muted, #94a3b8);\n}\n\n.ds-dial-plan-menu-options__field-hint {\n font-weight: 400;\n text-transform: none;\n letter-spacing: 0;\n opacity: 0.8;\n}\n\n.ds-dial-plan-menu-options__remove {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border: none;\n background: none;\n color: var(--ds-color-text-muted, #94a3b8);\n cursor: pointer;\n border-radius: 4px;\n flex-shrink: 0;\n}\n\n.ds-dial-plan-menu-options__remove:hover {\n color: var(--ds-color-danger, #ef4444);\n background: rgba(239, 68, 68, 0.1);\n}\n\n.ds-dial-plan-menu-options__add {\n padding: 3px 10px;\n border: 1px solid var(--ds-color-primary, #6366f1);\n background: none;\n color: var(--ds-color-primary, #6366f1);\n cursor: pointer;\n border-radius: 4px;\n font-size: 11px;\n font-weight: 500;\n white-space: nowrap;\n}\n\n.ds-dial-plan-menu-options__add:hover:not(:disabled) {\n background: var(--ds-color-primary, #6366f1);\n color: #ffffff;\n}\n\n.ds-dial-plan-menu-options__add:disabled {\n opacity: 0.4;\n cursor: default;\n}\n\n/* ============================================================================\n Handles\n ============================================================================ */\n\n.ds-dial-plan-handle {\n width: 10px;\n height: 10px;\n background: var(--ds-color-border, #e2e8f0);\n border: 2px solid var(--ds-color-background, #ffffff);\n}\n\n.ds-dial-plan-handle--next {\n background: var(--ds-color-text-secondary, #64748b);\n}\n\n/* ============================================================================\n React Flow Overrides (both viewer and editor)\n ============================================================================ */\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge-path {\n stroke: var(--ds-color-border, #94a3b8);\n stroke-width: 2;\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge.selected .react-flow__edge-path {\n stroke: var(--ds-color-primary, #3b82f6);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge-text {\n font-size: var(--ds-font-size-xs, 12px);\n fill: var(--ds-color-text-secondary, #64748b);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__background {\n background-color: var(--ds-color-background, #ffffff);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__minimap {\n background: var(--ds-color-background, #ffffff);\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls {\n border-radius: var(--ds-border-radius, 8px);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls-button {\n background: var(--ds-color-background, #ffffff);\n border-color: var(--ds-color-border, #e2e8f0);\n color: var(--ds-color-text, #1e293b);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls-button:hover {\n background: var(--ds-color-background-hover, #f8fafc);\n}\n\n/* ============================================================================\n Loading, Error, and Empty States\n ============================================================================ */\n\n.ds-dial-plan-viewer--loading,\n.ds-dial-plan-viewer--error,\n.ds-dial-plan-viewer--empty {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.ds-dial-plan-viewer__loading,\n.ds-dial-plan-viewer__error,\n.ds-dial-plan-viewer__empty {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 12px;\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-dial-plan-viewer__spinner {\n width: 32px;\n height: 32px;\n border: 3px solid var(--ds-color-border, #e2e8f0);\n border-top-color: var(--ds-color-primary, #3b82f6);\n border-radius: 50%;\n animation: ds-dial-plan-spin 0.8s linear infinite;\n}\n\n@keyframes ds-dial-plan-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n.ds-dial-plan-viewer__error {\n color: var(--ds-color-danger, #ef4444);\n}\n\n.ds-dial-plan-viewer__error-message {\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-text-secondary, #64748b);\n max-width: 300px;\n text-align: center;\n}\n\n/* ============================================================================\n Config Panel\n ============================================================================ */\n\n.ds-dial-plan-config-panel {\n width: 260px;\n height: 100%;\n background: var(--ds-color-background, #ffffff);\n border-left: 1px solid var(--ds-color-border, #e2e8f0);\n display: flex;\n flex-direction: column;\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n overflow-y: auto;\n}\n\n.ds-dial-plan-config-panel__header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 12px 16px;\n border-bottom: 1px solid var(--ds-color-border, #e2e8f0);\n}\n\n.ds-dial-plan-config-panel__header-icon {\n color: var(--ds-color-text-secondary, #64748b);\n display: flex;\n align-items: center;\n}\n\n.ds-dial-plan-config-panel__header-label {\n flex: 1;\n font-weight: 600;\n color: var(--ds-color-text, #1e293b);\n}\n\n.ds-dial-plan-config-panel__delete {\n color: var(--ds-color-danger, #ef4444);\n background: none;\n border: none;\n padding: 2px;\n cursor: pointer;\n display: flex;\n align-items: center;\n}\n\n.ds-dial-plan-config-panel__delete:hover {\n color: #dc2626;\n}\n\n.ds-dial-plan-config-panel__close {\n background: none;\n border: none;\n color: var(--ds-color-text-secondary, #64748b);\n cursor: pointer;\n padding: 2px;\n display: flex;\n align-items: center;\n}\n\n.ds-dial-plan-config-panel__close:hover {\n color: var(--ds-color-text, #1e293b);\n}\n\n.ds-dial-plan-config-panel__body {\n padding: 16px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n\n.ds-dial-plan-config-field {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n.ds-dial-plan-config-field__label {\n font-size: var(--ds-font-size-xs, 12px);\n font-weight: 500;\n color: var(--ds-color-text-secondary, #64748b);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n}\n\n.ds-dial-plan-config-field__select,\n.ds-dial-plan-config-field__input {\n width: 100%;\n padding: 6px 8px;\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n background: var(--ds-color-background, #ffffff);\n color: var(--ds-color-text, #1e293b);\n font-size: var(--ds-font-size-sm, 14px);\n font-family: inherit;\n outline: none;\n box-sizing: border-box;\n}\n\n.ds-dial-plan-config-field__checkbox {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text, #1e293b);\n cursor: pointer;\n}\n\n.ds-dial-plan-config-field__hint {\n margin: 4px 0 0;\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-text-secondary, #64748b);\n line-height: 1.4;\n}\n\n.ds-dial-plan-edge-panel__value {\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text, #1e293b);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-edge-panel__value {\n color: #e2e8f0;\n}\n\n.ds-dial-plan-config-field__open-link {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n background: none;\n border: none;\n padding: 0;\n margin-top: 4px;\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-primary, #3b82f6);\n cursor: pointer;\n font-family: inherit;\n}\n\n.ds-dial-plan-config-field__open-link:hover {\n text-decoration: underline;\n}\n\n.ds-dial-plan-config-field__select:focus,\n.ds-dial-plan-config-field__input:focus {\n border-color: var(--ds-color-primary, #3b82f6);\n box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);\n}\n\n.ds-dial-plan-config-field__input-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n}\n\n.ds-dial-plan-config-field__input-wrapper .ds-dial-plan-config-field__input {\n padding-right: 28px;\n}\n\n.ds-dial-plan-config-field__clear {\n position: absolute;\n right: 6px;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n padding: 0;\n border: none;\n border-radius: 50%;\n background: transparent;\n color: var(--ds-color-text-secondary, #64748b);\n cursor: pointer;\n}\n\n.ds-dial-plan-config-field__clear:hover {\n background: var(--ds-color-border, #e2e8f0);\n color: var(--ds-color-text, #1e293b);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__clear:hover {\n background: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n.ds-dial-plan-config-field__segmented {\n display: flex;\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n overflow: hidden;\n background: var(--ds-color-background, #ffffff);\n}\n\n.ds-dial-plan-config-field__segmented-option {\n flex: 1;\n padding: 6px 8px;\n border: none;\n background: transparent;\n color: var(--ds-color-text-secondary, #64748b);\n font-size: var(--ds-font-size-sm, 14px);\n font-family: inherit;\n cursor: pointer;\n}\n\n.ds-dial-plan-config-field__segmented-option + .ds-dial-plan-config-field__segmented-option {\n border-left: 1px solid var(--ds-color-border, #e2e8f0);\n}\n\n.ds-dial-plan-config-field__segmented-option--active {\n background: var(--ds-color-primary, #3b82f6);\n color: #ffffff;\n font-weight: 500;\n}\n\n.ds-dial-plan-config-field__hint {\n margin: 4px 0 0;\n font-size: var(--ds-font-size-xs, 11px);\n line-height: 1.4;\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-dial-plan-node__badge {\n display: block;\n width: fit-content;\n margin: 4px auto 0;\n padding: 2px 8px;\n border-radius: 999px;\n background: var(--ds-color-muted, #eef2ff);\n color: var(--ds-color-text-secondary, #64748b);\n font-size: var(--ds-font-size-xs, 11px);\n font-weight: 500;\n letter-spacing: 0.3px;\n text-align: center;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__badge {\n background: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n/* ============================================================================\n Resource Combobox\n ============================================================================ */\n\n.ds-resource-combobox {\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n background: var(--ds-color-background, #ffffff);\n overflow: hidden;\n}\n\n.ds-resource-combobox__trigger {\n width: 100%;\n padding: 6px 8px;\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n background: var(--ds-color-background, #ffffff);\n color: var(--ds-color-text, #1e293b);\n font-size: var(--ds-font-size-sm, 14px);\n font-family: inherit;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n text-align: left;\n}\n\n.ds-resource-combobox__trigger:hover {\n border-color: var(--ds-color-primary, #3b82f6);\n}\n\n.ds-resource-combobox__trigger-placeholder {\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-resource-combobox__trigger-chevron {\n color: var(--ds-color-text-secondary, #64748b);\n opacity: 0.5;\n flex-shrink: 0;\n}\n\n.ds-resource-combobox__input {\n width: 100%;\n padding: 8px 10px;\n border: none;\n border-bottom: 1px solid var(--ds-color-border, #e2e8f0);\n background: transparent;\n color: var(--ds-color-text, #1e293b);\n font-size: var(--ds-font-size-sm, 14px);\n font-family: inherit;\n outline: none;\n box-sizing: border-box;\n}\n\n.ds-resource-combobox__input::placeholder {\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-resource-combobox__list {\n max-height: 400px;\n overflow-y: auto;\n padding: 4px 0;\n}\n\n.ds-resource-combobox__group [cmdk-group-heading] {\n padding: 6px 10px 2px;\n font-size: var(--ds-font-size-xs, 12px);\n font-weight: 500;\n color: var(--ds-color-text-secondary, #64748b);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n}\n\n.ds-resource-combobox__item {\n padding: 6px 10px;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text, #1e293b);\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n border-radius: 0;\n}\n\n.ds-resource-combobox__item[data-selected="true"] {\n background: var(--ds-color-primary, #3b82f6);\n color: #ffffff;\n}\n\n.ds-resource-combobox__item--selected {\n font-weight: 500;\n}\n\n.ds-resource-combobox__name {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.ds-resource-combobox__ext {\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-text-secondary, #64748b);\n margin-left: auto;\n padding-left: 8px;\n white-space: nowrap;\n flex-shrink: 0;\n}\n\n.ds-resource-combobox__check {\n font-size: 12px;\n opacity: 0.7;\n width: 16px;\n text-align: center;\n flex-shrink: 0;\n}\n\n.ds-resource-combobox__create {\n padding: 6px 10px;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-primary, #3b82f6);\n cursor: pointer;\n font-style: italic;\n}\n\n.ds-resource-combobox__create[data-selected="true"] {\n background: var(--ds-color-primary, #3b82f6);\n color: #ffffff;\n}\n\n.ds-resource-combobox__empty {\n padding: 12px 10px;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text-secondary, #64748b);\n text-align: center;\n}\n\n/* ============================================================================\n Dark Mode\n Activated by .dark class on an ancestor (Tailwind / next-themes convention)\n or data-theme="dark" attribute.\n ============================================================================ */\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-viewer,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor {\n background: #1a1a2e;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node {\n background: #1e1e32;\n border-color: rgba(255, 255, 255, 0.1);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__label,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__name {\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__icon,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__type-label,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__type,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__exit-label {\n color: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__exits {\n border-top-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--themed {\n background: color-mix(in srgb, var(--node-color) 20%, #1a1a2e);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--schedule {\n background: linear-gradient(135deg, #0c2d48 0%, #0a3761 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--internal-dial {\n background: linear-gradient(135deg, #052e16 0%, #064e3b 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--voicemail {\n background: linear-gradient(135deg, #2e1065 0%, #3b0764 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--ring-all-users {\n background: linear-gradient(135deg, #451a03 0%, #78350f 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--external-dial {\n background: linear-gradient(135deg, #4c0519 0%, #881337 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--voice-app {\n background:\n linear-gradient(135deg, #252262 0%, #3b1d7e 40%, #0c3a5e 100%) padding-box,\n linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box;\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--menu {\n background: linear-gradient(135deg, #500724 0%, #831843 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--audio-clip {\n background: linear-gradient(135deg, #042f2e 0%, #115e59 100%);\n}\n\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-handle {\n border-color: #1e1e32;\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__background {\n background-color: #1a1a2e;\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge-path {\n stroke: rgba(255, 255, 255, 0.2);\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge-text {\n fill: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__minimap {\n background: #1e1e32;\n border-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls {\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls-button {\n background: #1e1e32;\n border-color: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls-button:hover {\n background: #2a2a45;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-viewer__loading,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-viewer__empty {\n color: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-viewer__spinner {\n border-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel {\n background: #1e1e32;\n border-left-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel__header {\n border-bottom-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel__header-label {\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel__close {\n color: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel__close:hover {\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__label {\n color: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__select,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__input {\n background: #12122a;\n border-color: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox__trigger {\n background: #12122a;\n border-color: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox {\n border-color: rgba(255, 255, 255, 0.1);\n background: #12122a;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox__input {\n color: #e2e8f0;\n border-bottom-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox__item {\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox__item--selected {\n color: #e2e8f0;\n}\n\n/* Node Library */\n\n.ds-dial-plan-node-library {\n width: 200px;\n height: 100%;\n background: var(--ds-color-background, #ffffff);\n border-right: 1px solid var(--ds-color-border, #e2e8f0);\n display: flex;\n flex-direction: column;\n gap: 10px;\n padding: 12px;\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n overflow-y: auto;\n}\n\n.ds-dial-plan-node-library__item {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n padding: 10px 12px;\n border-radius: var(--ds-border-radius, 8px);\n border: 2px solid var(--node-color, var(--ds-color-border, #e2e8f0));\n background: color-mix(in srgb, var(--node-color, #ffffff) 10%, white);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n cursor: grab;\n transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;\n}\n\n.ds-dial-plan-node-library__item:hover {\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);\n transform: translateY(-1px);\n}\n\n.ds-dial-plan-node-library__item:active {\n cursor: grabbing;\n transform: scale(0.97);\n}\n\n/* Per-type library item colors */\n.ds-dial-plan-node-library__item--schedule { background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%); border-color: var(--ds-color-info, #0ea5e9); }\n.ds-dial-plan-node-library__item--internal_dial { background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%); border-color: var(--ds-color-success, #22c55e); }\n.ds-dial-plan-node-library__item--voicemail { background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%); border-color: var(--ds-color-purple, #a855f7); }\n.ds-dial-plan-node-library__item--ring_all_users { background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%); border-color: var(--ds-color-warning, #f59e0b); }\n.ds-dial-plan-node-library__item--external_dial { background: linear-gradient(135deg, #fff1f2 0%, #fecdd3 100%); border-color: var(--ds-color-rose, #f43f5e); }\n.ds-dial-plan-node-library__item--voice_app,\n.ds-dial-plan-node-library__item--voice_app:hover {\n border: 2px solid transparent;\n background: linear-gradient(135deg, #c7d2fe 0%, #ddd6fe 40%, #bae6fd 100%) padding-box, linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box;\n}\n.ds-dial-plan-node-library__item--menu { background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%); border-color: #ec4899; }\n.ds-dial-plan-node-library__item--audio_clip { background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%); border-color: #14b8a6; }\n\n.ds-dial-plan-node-library__item-icon {\n display: flex;\n align-items: center;\n color: var(--node-color);\n}\n.ds-dial-plan-node-library__item--schedule .ds-dial-plan-node-library__item-icon { color: var(--ds-color-info, #0ea5e9); }\n.ds-dial-plan-node-library__item--internal_dial .ds-dial-plan-node-library__item-icon { color: var(--ds-color-success, #22c55e); }\n.ds-dial-plan-node-library__item--voicemail .ds-dial-plan-node-library__item-icon { color: var(--ds-color-purple, #a855f7); }\n.ds-dial-plan-node-library__item--ring_all_users .ds-dial-plan-node-library__item-icon { color: var(--ds-color-warning, #f59e0b); }\n.ds-dial-plan-node-library__item--external_dial .ds-dial-plan-node-library__item-icon { color: var(--ds-color-rose, #f43f5e); }\n.ds-dial-plan-node-library__item--voice_app .ds-dial-plan-node-library__item-icon { color: #4f46e5; }\n.ds-dial-plan-node-library__item--menu .ds-dial-plan-node-library__item-icon { color: #ec4899; }\n.ds-dial-plan-node-library__item--audio_clip .ds-dial-plan-node-library__item-icon { color: #14b8a6; }\n\n.ds-dial-plan-node-library__item-label {\n font-size: var(--ds-font-size-xs, 12px);\n font-weight: 600;\n color: var(--ds-color-text, #1e293b);\n text-align: center;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library {\n background: #1e1e32;\n border-right-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item {\n background: color-mix(in srgb, var(--node-color, #1e1e32) 20%, #1e1e32);\n border-color: rgba(255, 255, 255, 0.1);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--schedule { background: linear-gradient(135deg, #0c2d48 0%, #0a3761 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--internal_dial { background: linear-gradient(135deg, #052e16 0%, #064e3b 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--voicemail { background: linear-gradient(135deg, #2e1065 0%, #3b0764 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--ring_all_users { background: linear-gradient(135deg, #451a03 0%, #78350f 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--external_dial { background: linear-gradient(135deg, #4c0519 0%, #881337 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--voice_app { background: linear-gradient(135deg, #252262 0%, #3b1d7e 40%, #0c3a5e 100%) padding-box, linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box; }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--menu { background: linear-gradient(135deg, #500724 0%, #831843 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--audio_clip { background: linear-gradient(135deg, #042f2e 0%, #115e59 100%); }\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item-label {\n color: #e2e8f0;\n}\n\n/* ============================================================================\n Editor Toolbar\n ============================================================================ */\n\n.ds-dial-plan-editor-toolbar {\n position: absolute;\n top: 16px;\n right: 16px;\n z-index: 10;\n display: flex;\n gap: 8px;\n}\n\n.ds-dial-plan-editor-toolbar__button {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 8px 12px;\n background: var(--ds-color-background, #ffffff);\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n color: var(--ds-color-text, #1e293b);\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n font-weight: 500;\n cursor: pointer;\n transition: all 0.15s ease;\n}\n\n.ds-dial-plan-editor-toolbar__button:hover {\n background: var(--ds-color-background-hover, #f1f5f9);\n border-color: var(--ds-color-border, #cbd5e1);\n}\n\n.ds-dial-plan-editor-toolbar__button:active {\n transform: scale(0.98);\n}\n\n.ds-dial-plan-editor-toolbar__button:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n}\n\n.ds-dial-plan-editor-toolbar__button:disabled:hover {\n background: var(--ds-color-background, #ffffff);\n border-color: var(--ds-color-border, #e2e8f0);\n}\n\n.ds-dial-plan-editor-toolbar__button svg {\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor-toolbar__button {\n background: #1e293b;\n border-color: #334155;\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor-toolbar__button:hover {\n background: #334155;\n border-color: #475569;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor-toolbar__button:disabled:hover {\n background: #1e293b;\n border-color: #334155;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor-toolbar__button svg {\n color: #cbd5e1;\n}\n\n/* Editor Layout */\n\n.ds-dial-plan-editor {\n display: flex;\n width: 100%;\n height: 100%;\n flex: 1;\n min-height: 400px;\n background: var(--ds-color-background, #ffffff);\n overflow: hidden;\n}\n\n.ds-dial-plan-editor--preview {\n min-height: 0;\n}\n\n.ds-dial-plan-editor__canvas {\n flex: 1;\n position: relative;\n}\n\n/* Node Library wrapper */\n\n.ds-dial-plan-node-library-wrapper {\n width: 200px;\n flex-shrink: 0;\n align-self: stretch;\n overflow: hidden;\n}\n\n/* Config panel wrapper (slide-in animation) */\n\n.ds-dial-plan-config-panel-wrapper {\n width: 0;\n flex-shrink: 0;\n align-self: stretch;\n overflow: hidden;\n transition: width 0.2s ease;\n}\n\n.ds-dial-plan-config-panel-wrapper--open {\n width: 260px;\n}\n\n\n'],De=e.forwardRef((a,t)=>{var l;const{dialstack:r}=E(),i=function(e){const[a,t]=n(()=>e.getAppearance());return o(()=>{if("undefined"==typeof document)return;const n=document.createElement("div"),o=e=>{const n=e.detail;t(null==n?void 0:n.appearance)};return n.addEventListener("dialstack-appearance-update",o),e.addAppearanceTarget(n),()=>{e.removeAppearanceTarget(n),n.removeEventListener("dialstack-appearance-update",o)}},[e]),a}(r),d="dark"===(null==i?void 0:i.theme)?"dark":"light",s=null!==(l=a.theme)&&void 0!==l?l:d;return e.createElement(ze,{stylesheets:Pe,className:a.className,style:Object.assign({width:"100%",height:"100%",flex:1,minHeight:0},a.style)},e.createElement("div",{"data-theme":s,style:{display:"flex",flexDirection:"column",flex:1,minHeight:0}},e.createElement(f,null,e.createElement(Ie,Object.assign({ref:t},a)))))});De.displayName="DialPlan";export{De as DialPlan};
2
+ //# sourceMappingURL=dial-plan.mjs.map